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,329 of 10,840   
   Antony Clements to J French   
   Re: question about directory list boxes   
   26 Dec 06 22:20:58   
   
   From: antony.clements@optusnet.com.au   
      
   thanks for that J French   
      
   "J French"  wrote in message   
   news:4590c92b.1274040@news.btopenworld.com...   
   > See inline :-   
   >   
   > On Tue, 26 Dec 2006 11:38:01 +1100, "Antony Clements"   
   >  wrote:   
   >   
   >>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   
   >         Dir1.Path = Dir1.List(Dir1.ListIndex)   '<=== Add This ===   
   >>        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   
   >   
   > The highlighted Directory is NOT the selected Directory, that only   
   > happens with a double click.   
   >   
   > If I were you I would wrap this in a UserControl, it is the sort of   
   > thing that you will probably want to re-use.   
   >   
   >   
   >   
      
   --- 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