hrolsons
asked on
webbrowser causing cursor to disappear
On a form, I have a textbox, and a webbrowser control, which has google loaded up.
I click in my textbox and I have a nice flashing cursor.
I click in a black space in the webbrowser, then click in my textbox, and there is no blinking cursor, but I can type into that textbox.
Any ideas? I've been working on this bug forever now.
I click in my textbox and I have a nice flashing cursor.
I click in a black space in the webbrowser, then click in my textbox, and there is no blinking cursor, but I can type into that textbox.
Any ideas? I've been working on this bug forever now.
Oh, is this VB classic?
ASKER
Yes, VB6
Ok, can you try this instead?
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Screen.MousePointer = MousePointerConstants.vbDefault
End Sub
ASKER
Didn't work, yv989c
I'm working on it, I know what the problem is ;) I will let you know when I got something.
Hello buddy!
In a form add a webbrowser control named WebBrowser1, and some textboxes to play, use this code on it:
In a form add a webbrowser control named WebBrowser1, and some textboxes to play, use this code on it:
Private Sub Form_Load()
WebBrowser1.Navigate2 "www.google.com"
End Sub
Private Sub WebBrowser1_LostFocus()
Dim ac As Control
Set ac = Me.ActiveControl
Me.SetFocus
If Not ac Is Nothing Then
If ac.Enabled And ac.Visible Then
ac.SetFocus
End If
End If
End Sub
I hope this work for you.
ASKER
Looks like it's close. Still having a problem when WebBrowser1 loses focus to WebBrowser2.
Easy bro, add:
Private Sub WebBrowser2_LostFocus()
Dim ac As Control
Set ac = Me.ActiveControl
Me.SetFocus
If Not ac Is Nothing Then
If ac.Enabled And ac.Visible Then
ac.SetFocus
End If
End If
End Sub
ASKER
No, click on webbrowser1 and then click on webbrowser2 and an error will happen.
"Object doesn't support this property or method"
"Object doesn't support this property or method"
what code line?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I see your "On Error Resume Next"
Would I need "On Error goto 0" at the end of the sub, or does it default back to that for the rest of my code after the sub ends?
Would I need "On Error goto 0" at the end of the sub, or does it default back to that for the rest of my code after the sub ends?
I don't remember very well, I don't think so, but to be sure, add a command button and raise an error, like this: Err.Raise
If the error is throw then its fine.
If the error is throw then its fine.
I don't think that you need the On Error goto 0 at the end
ASKER
It didn't show the error.
ASKER
If I press the button twice it does come up. It's almost like the first click you make after a webbrowser, doesn't work. You fixed my first problem though, so I'll move on. Thank You.
Thanks buddy, but now I see that it is more simple:
Private Sub WebBrowser1_LostFocus()
On Error Resume Next
Me.SetFocus
End Sub
Just make use of this code, it still a little buggy, but this fix your cursor problem.
Open in new window