G
Guest
Guyz,
I have just learnt how to add the 'DriveListBox', 'DirListBox' and
'FileListBox' controls that were always included in the toolbox with VB 3.0 /
4.0 / 5.0, but always missing in VBE 2005.
And I have managed to create a simple file browsing project with the
'DriveListBox',
'DirListBox' and 'FileListBox' controls with the following code on the
'Form1' form:-
Private Sub CmdExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CmdExit.Click
REM Exiting the program whenever the user clicks on the
REM 'Exit' button. Added on Tuesday 23rd January 2007.
REM Exiting the program. Added on Tuesday 23rd January
REM 2007.
End
End Sub
Private Sub Drives_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs)
REM Update the 'Path' property of the 'Directories' directory list
REM box whenever the user clicks on a drive listed in the 'Drives'
REM drive list box. Added on Tuesday 23rd January 2007.
REM Setting the 'Path' property of the 'Directories' directory list
REM box. Added on Tuesday 23rd January 2007.
Directories.Path = Convert.ToString(Drives.SelectedItem)
End Sub
Private Sub Directories_Change(ByVal sender As Object, ByVal e As
System.EventArgs)
REM Update the 'Path' property of the 'Files' file list box whenever
REM the user clicks on a directory listed in the 'Directories'
directory
REM list box. Added on Tuesday 23rd January 2007.
REM Updating the 'Path' property of the 'Files' file list box.
REM Added on Tuesday 23rd January 2007.
Files.Path = Directories.Path
End Sub
Remember that I am using Visual Basic Express 2005. When I run the program,
the code works. Selecting a drive letter in the 'Drives' DriveListBox
control changes
what is displayed in the 'Directories' DirListBox control which in turn
changes what is displayed in the 'Files' FileListBox' control.
Likewise, selecting a directory in the 'Directories' DirListBox' control
changes what is displayed in the 'Files' FileListBox control.
The sample project allows you to browse all local directories on your
computer and all remote directories on another computer.
The problem is that when I try to copy the controls and drop them into a
GroupBox control (which used to be the Frame control in VB 3.0 / 4.0 / 5.0)
and the same
program code are also copied, with the new controls being named 'Drives2',
'Directories2' and 'Files2'.
What happens when I try to run the project, is that the code for the
'Drives2',
'Directories2' and 'Files2' controls in the GroupBox control no longer works
whereas
the code for the 'Drives', 'Directories' and 'Files' controls outside the
GroupBox control do work.
i.e. clicking on a drive letter in the 'Drives' control outside the GroupBox
control updates the contents of the 'Directories' and 'Files' controls, but
clicking on a drive letter in the 'Drives2' control inside the GroupBox
control does not update the contents of the 'Directories2' and 'Files2'
controls.
What is missing? Where am I going wrong? How can I fix this problem?
I have been using VB 5.0 for nearly 10 years, and I have just recently
started exploring VBE 2005 after installing it last May.
Any help / advice would be most appreciated. Thanks in advance.
I have just learnt how to add the 'DriveListBox', 'DirListBox' and
'FileListBox' controls that were always included in the toolbox with VB 3.0 /
4.0 / 5.0, but always missing in VBE 2005.
And I have managed to create a simple file browsing project with the
'DriveListBox',
'DirListBox' and 'FileListBox' controls with the following code on the
'Form1' form:-
Private Sub CmdExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CmdExit.Click
REM Exiting the program whenever the user clicks on the
REM 'Exit' button. Added on Tuesday 23rd January 2007.
REM Exiting the program. Added on Tuesday 23rd January
REM 2007.
End
End Sub
Private Sub Drives_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs)
REM Update the 'Path' property of the 'Directories' directory list
REM box whenever the user clicks on a drive listed in the 'Drives'
REM drive list box. Added on Tuesday 23rd January 2007.
REM Setting the 'Path' property of the 'Directories' directory list
REM box. Added on Tuesday 23rd January 2007.
Directories.Path = Convert.ToString(Drives.SelectedItem)
End Sub
Private Sub Directories_Change(ByVal sender As Object, ByVal e As
System.EventArgs)
REM Update the 'Path' property of the 'Files' file list box whenever
REM the user clicks on a directory listed in the 'Directories'
directory
REM list box. Added on Tuesday 23rd January 2007.
REM Updating the 'Path' property of the 'Files' file list box.
REM Added on Tuesday 23rd January 2007.
Files.Path = Directories.Path
End Sub
Remember that I am using Visual Basic Express 2005. When I run the program,
the code works. Selecting a drive letter in the 'Drives' DriveListBox
control changes
what is displayed in the 'Directories' DirListBox control which in turn
changes what is displayed in the 'Files' FileListBox' control.
Likewise, selecting a directory in the 'Directories' DirListBox' control
changes what is displayed in the 'Files' FileListBox control.
The sample project allows you to browse all local directories on your
computer and all remote directories on another computer.
The problem is that when I try to copy the controls and drop them into a
GroupBox control (which used to be the Frame control in VB 3.0 / 4.0 / 5.0)
and the same
program code are also copied, with the new controls being named 'Drives2',
'Directories2' and 'Files2'.
What happens when I try to run the project, is that the code for the
'Drives2',
'Directories2' and 'Files2' controls in the GroupBox control no longer works
whereas
the code for the 'Drives', 'Directories' and 'Files' controls outside the
GroupBox control do work.
i.e. clicking on a drive letter in the 'Drives' control outside the GroupBox
control updates the contents of the 'Directories' and 'Files' controls, but
clicking on a drive letter in the 'Drives2' control inside the GroupBox
control does not update the contents of the 'Directories2' and 'Files2'
controls.
What is missing? Where am I going wrong? How can I fix this problem?
I have been using VB 5.0 for nearly 10 years, and I have just recently
started exploring VBE 2005 after installing it last May.
Any help / advice would be most appreciated. Thanks in advance.