Select All

R

RobcPettit

Hi, I was having problems, from with in my program to SelectAll within
a webbrowser, copy then paste to a rtftextbox. Ive resolved this
using:
webBrowser1.Focus();
SendKeys.SendWait("^a^c");
richTextBox1.Focus();
richTextBox1.AppendText("\r" + "New");
SendKeys.SendWait("^+{END}");
SendKeys.SendWait("^v"); hich works ok for me. To me it looks a bit
clumsy though. I did read a few articles though were
'webBrowser1.Document.ExecCommand("SelectAll", true, null); ' was
bieng used. They all seemed to get this to work ok. Unfortunatly I
couldnt. Any pointers as to were I could be going wrong, I couldnt
find any clear code examples showing what references were bieng used.
Ive added a ref to mshtml.
Regads Robert
 
A

Alberto Poblacion

Hi, I was having problems, from with in my program to SelectAll within
a webbrowser, copy then paste to a rtftextbox. Ive resolved this
using:
webBrowser1.Focus();
SendKeys.SendWait("^a^c");

I don't have a solution for your problem, but I wanted to warn you that
if you want to distribute your software the way you have currently
programmed it, you will need to make this key sequence configurable, since
it varies on different language versions of the operating system. For
instance, on Spanish versions of Windows, the command for "Select All" is
Ctrl-E instead of Ctrl-A.
 
N

Nicholas Paldino [.NET/C# MVP]

Robert,

Well, you said you couldn't get it to work. What were you doing to try
and get it to work (was it just that one line, and what reference do you
have that it would work), and what was the error that you were getting?

Looking at the documentation for the SelectAll command identifier, the
user interface parameter needs to be omitted, or set to false. You have it
set to true.
 
R

RobcPettit

Thankyou for your replys, I have got it working now. Im not entirely
sure as to why it didnt work. I added code to tell the code to pause
until the webrowser readystate was true before continuing. So I think
I was fireing before on a empty browser. Ive also put a try and catch
in to catch such errors in future.
Regards Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top