Question:
Visual Basic Question - Pasting from the clipboard?
2008-10-20 03:06:37 UTC
I have a problem which in reality should be simple, but in VB is complicated. This is the first time I have to say its the stupid compilers fault.

The problem I am having is pasting text from one textbox on my VB form to another textbox in a web browser object.
In other words when a website is loaded up for example (www.google.co.uk) in the web browser object. I want text copied from textbox1.text and pasted into the textbox located on the webpage.

I have used VB Tabs to get my web browser cursor in the textbox on a webpage but its not pasting anything from the clipboard, when the command says copy textbox1.text to clipboard and then paste. I have tried send keys, however I am unsure I am using the write command keys for send keys option.

Sorry if it seems confusing. I just want this question answering:
When a website is loaded up for example (www.google.co.uk) in the web browser object. I want text copied from textbox1.text and pasted into the textbox located on the webpage.

Full stars, best answer for the answer which resolves my problem.
Four answers:
JohnEightyOne
2008-10-21 09:16:38 UTC
Private Sub Command1_Click()

If WebBrowser1.ReadyState = READYSTATE_COMPLETE Then

WebBrowser1. _

Document. _

documentElement. _

All("q").Value = Text1.Text

End If

End Sub



Private Sub Form_Load()

WebBrowser1.Navigate "http://www.google.co.uk"

End Sub
Paxo
2008-10-21 06:37:32 UTC
I'm not sure what you're trying to do is possible the way you describe it.



Do you mean that you want a Windows Forms application that has an Internet Explorer control in it, and you want to paste specific information into controls on the Internet Explorer page?



The problem you've got is that you've no idea how to reference the controls on the web page. What will they be called?



An alternative is to take a leaf out of IE7s book. To use a new search provider, they tell you to search for TEST (capitals). If you do this in Google, you get http://www.google.co.uk/search?hl=en&q=TEST&meta=

Subsitute your search string for TEST and navigate to that URL in your control
?
2016-10-18 11:56:15 UTC
I hate when I say, "thank you," and get carry of a reaction of, "No challenge." Gee, i did no longer think of of it substitute top right into a challenge. I additionally proceed hating to pay interest 39 reiterations of "like" in sentences, and loathe "bypass" substituting badly for "stated." and don't even get me began on "way" getting used as against "very" and "plenty." Oh, and that's turning out to be a deadly disease for people to word double previous-stressful shape, which incorporates "you could desire to have went." And talking of "went," i at modern heard somebody bastardize "bypass" into the previous stressful "bypass'ed"
Funky G
2008-10-20 03:24:39 UTC
I did something liek this a while ago.



You will need to know the name of the textbox on the webbrowser.



IE:

if google textbox is called searchbox.



You shoudl be able to do something like..



form1.webbrowserobject.innerhtml.searchbox.value = text1.text



Or along those lines.

You basically need to tell your webbrowser object to update its inner html with information from your text box.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...