home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,326 of 10,840   
   Antony Clements to All   
   question about directory list boxes   
   26 Dec 06 11:38:01   
   
   From: antony.clements@optusnet.com.au   
      
   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   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca