i have written a program that incorporates the following code.
Private Sub Dir1_Change()
'changes the folder and displays each file in the folder
On Error Resume Next
File1.Path = Dir1.Path
RaiseEvent DirectoryChanged(Dir1.Path)
File1.Selected(0) = True
frmMain2.lblFileIn.Caption = Dir1.Path
frmMain2.lblFileOut.Caption = Dir1.Path
End Sub
is there any way i can modify this code to also work with a keypress event?
i have tried the following, but it doesn't work.
Private Sub Dir1_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = vbKeyReturn Then
File1.Path = Dir1.Path
RaiseEvent DirectoryChanged(Dir1.Path)
File1.Selected(0) = True
frmMain2.lblFileIn.Caption = Dir1.Path
frmMain2.lblFileOut.Caption = Dir1.Path
End If
End Sub