|
-
May 9th, 2013, 11:09 PM
#1
Thread Starter
Lively Member
[RESOLVED] Question about SendKeys.Send
Hello,
I have a question regarding SendKeys.Send; everything I've read leads me to believe this code should output the text I assign SendKeys at the cursor location in google, but when the program activates SendKeys, webbrowser1 looses focus and there is no output. Any ideas what I'm doing wrong? As a polite request, I already know how to do this using html.elements, but I'd like to try it a different way all the same; thank you.
Code:
Public Class Form1
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
WebBrowser1.Navigate("www.google.com")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Focus()
SendKeys.Send("yahoo!")
End Sub
End Class
-
May 9th, 2013, 11:40 PM
#2
Re: Question about SendKeys.Send
try,
Code:
WebBrowser1.Document.Body.Focus()
SendKeys.Send("yahoo!")
-
May 9th, 2013, 11:49 PM
#3
Thread Starter
Lively Member
Re: Question about SendKeys.Send
Nope . As soon as I click the button, the cursor just disappears as if the program focuses on another part of the document and no text is displayed. I should mention that I've tried multiple web sites, not just google.
-
May 9th, 2013, 11:54 PM
#4
Thread Starter
Lively Member
Re: Question about SendKeys.Send
Humm, I have nooooo idea why it wasn't working! I made a completely new worksheet and just input the code raw, no copy/paste, and now it works?!? Literally, nothing is different than what is in that code. Very strange. Well at least I know it works ! I'll add to your rep.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|