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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileListBox_KeyPress()... need it to work with ENTER button

Status
Not open for further replies.

JESTAR

Programmer
Feb 13, 2002
213
GB
Public Sub OpenDocument(DocPath As String)
Dim A As Long
A = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & DocPath, vbMaximizedFocus)
End Sub

Private Sub FileList_DblClick()
OpenDocument (Address.Text)
End Sub

I got the OpenDocument sub from the FAQs. I can't get the file to open when it is selected and the ENTER button is pushed, I can get it to work with other buttons though.

Any ideas?
 
try using the filelist_keydown event to look for enter

good luck! If somethings hard to do, its not worth doing - Homer Simpson
 
I tried it and the keypress event works too... make sure that the declaration for the keypress event handler is proper.... i.e. if ur typing the declaration (rather than selecting the event from the drop down box)....

The following code worked:
Public Sub OpenDocument(DocPath As String)
Dim A As Long
A = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " & DocPath, vbMaximizedFocus)
End Sub

Private Sub fileList_keypress(keyascii As Integer)
If keyascii = 13 Then
OpenDocument (FileList.FileName)
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top