Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Keypress Event Blocked By Browser Object 1

Status
Not open for further replies.

hererxnl

Technical User
Jul 8, 2003
239
US

I'm trying to trap ESC Ascii in Form Keypress Event but it seems the Browser object on the form is preventing all Form Keypress events from being fired.

Keypreview Property of the form is set to true.
Threw DoEvents In for fun :)

Code:
Private Sub Form_KeyPress(KeyAscii As Integer)

    DoEvents
    MsgBox "Key " & KeyAscii & " Was Just Pressed Pressed."
    
End Sub
Any ideas?

Thanks is advance (as always)
 
Asuming you are using the Microsoft Internet Controls to embed a browser, add an empty, borderless picturebox to you form, and add this code:

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Picture1.SetFocus
End Sub
 

strongm:

Thanks for the response. I thought of doing that, and your suggestion reignited the notion. Works perfecct, though I had to relocate it to Form_Activate. It was throwing an invalid procedure call or arguement when inside the browser event. I'm guessing the document probably wasn't fully complete when focus was being set.

Thanks again. A Star for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top