By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,649 Members | 1,816 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,649 IT Pros & Developers. It's quick & easy.

VB 6.0 Cntrls In VBE - 'DriveListBox', 'DirListBox' & 'FileListBox

P: n/a
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.
Jan 26 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Next time, *cross-post* rather than *multi-post* your message. I swear
I've seen this in at least 2 other newsgroups. If you post it to
multiple
groups, do it all at once rather then doing each one individually. This
way,
if someone in one group responds, the people in the other groups know
and can respond appropriately.

That said, I agree with the response in the other group, REM's are old
hat,
replace with single quote. And take out the End statement.

How is the Directories_Change event being invoked? Is that set in the
designer and it's a listbox or something like that?

My guess would be that the events are assigned to the controls called
[Drives], [Directories] and [Files], and coded that way, so if you have
[drives2], [directories2], and [files2], they don't fire the same events
because they have a different name.

Just for grins, delete the 2's, then select the original ones, do a Cut,
click on the group control, then do a paste to paste them inside it.

Another (safer) way to do this it to display the Document Outline, which
shows all the controls and what containers they are (or aren't) in,
and you can drag them from one container to another. To see that,
View/OtherWindows/DocumentOutline.

Then run it, and see if it works.

Robin S.
--------------------------------------------------
"Scanboy" <Sc*****@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
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.


Jan 26 '07 #2

P: n/a


"Scanboy" wrote:
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.


The work-around is this:-

1. Drop a label control on the form.

2. Set the 'AutoSize' property of the label control to FALSE.

3. Set the 'BorderStyle' property of the label control to 'Fixed3D'.

4. Make the 'Text' property of the label control an empty string.

5. Then position the 'Drives', 'Directories' and 'Files' controls so
that they appear to be inside the label. Resize the label if
necessary to accomodate the controls.

6. If you want the label's border around the 'Drives', 'Directories'
and 'Files' controls to have a title, drag another label control onto
top of the first label control and position the second label control
over the first label control so that the border around the 'Drives',
'Directories' and 'Files' controls appears to have a title, in a similar
fashion to the Frame control in VB 3.0 / 4.0 / 5.0.

7. Set the 'Text' property of the second label control to whatever
you like.

8. When you run the project, all you see is what appears to be a 3D
border around the drives, directories and files, with a title.

Nobody is any wiser, but only you know different.

Jan 26 '07 #3

P: n/a
Robin,

Thanx for replying. I am quite new to .NET development and I am still
finding my way around, so you will have to bear with me. I am still in
the dark as to the purpose of the 'Document Outline' icon, and what you
can do / cannot do with it.

However, the work-around I have just posted in response to my earlier
post is just what I was looking for. Thanx anyway.
SB
-------------------------------------------------------------------------------------
"RobinS" wrote:
Next time, *cross-post* rather than *multi-post* your message. I swear
I've seen this in at least 2 other newsgroups. If you post it to
multiple
groups, do it all at once rather then doing each one individually. This
way,
if someone in one group responds, the people in the other groups know
and can respond appropriately.

That said, I agree with the response in the other group, REM's are old
hat,
replace with single quote. And take out the End statement.

How is the Directories_Change event being invoked? Is that set in the
designer and it's a listbox or something like that?

My guess would be that the events are assigned to the controls called
[Drives], [Directories] and [Files], and coded that way, so if you have
[drives2], [directories2], and [files2], they don't fire the same events
because they have a different name.

Just for grins, delete the 2's, then select the original ones, do a Cut,
click on the group control, then do a paste to paste them inside it.

Another (safer) way to do this it to display the Document Outline, which
shows all the controls and what containers they are (or aren't) in,
and you can drag them from one container to another. To see that,
View/OtherWindows/DocumentOutline.

Then run it, and see if it works.

Robin S.
--------------------------------------------------
"Scanboy" <Sc*****@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
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.


Jan 26 '07 #4

P: n/a
Robin,

By the way, I am not a regular on these ngs. Didn't know what ngs are
out there, so I just looked for ones that I thought were appropiate for my
posts.

Besides, I am using mum's computer, which does not have a newsreader
installed whereas I have Newsrover installed on mine, so I am replying to
this via Microsoft's online web-based Usenet browser.
SB
-----------------------------------------------------------------------------------
"RobinS" wrote:
Next time, *cross-post* rather than *multi-post* your message. I swear
I've seen this in at least 2 other newsgroups. If you post it to
multiple
groups, do it all at once rather then doing each one individually. This
way,
if someone in one group responds, the people in the other groups know
and can respond appropriately.

That said, I agree with the response in the other group, REM's are old
hat,
replace with single quote. And take out the End statement.

How is the Directories_Change event being invoked? Is that set in the
designer and it's a listbox or something like that?

My guess would be that the events are assigned to the controls called
[Drives], [Directories] and [Files], and coded that way, so if you have
[drives2], [directories2], and [files2], they don't fire the same events
because they have a different name.

Just for grins, delete the 2's, then select the original ones, do a Cut,
click on the group control, then do a paste to paste them inside it.

Another (safer) way to do this it to display the Document Outline, which
shows all the controls and what containers they are (or aren't) in,
and you can drag them from one container to another. To see that,
View/OtherWindows/DocumentOutline.

Then run it, and see if it works.

Robin S.
--------------------------------------------------
"Scanboy" <Sc*****@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
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.


Jan 26 '07 #5

P: n/a
The Document Outline shows all of the controls on your form in a tree
format. So if you have a panel with two textboxes on it and a groupbox
with three radio buttons, they will show up as a tree in the Document
Outline. This way you can easily check and see if your controls are in
the right panel.

Robin S.
----------------------------------------------
"Scanboy" <Sc*****@discussions.microsoft.comwrote in message
news:EF**********************************@microsof t.com...
Robin,

Thanx for replying. I am quite new to .NET development and I am still
finding my way around, so you will have to bear with me. I am still
in
the dark as to the purpose of the 'Document Outline' icon, and what
you
can do / cannot do with it.

However, the work-around I have just posted in response to my earlier
post is just what I was looking for. Thanx anyway.
SB
-------------------------------------------------------------------------------------
"RobinS" wrote:
>Next time, *cross-post* rather than *multi-post* your message. I
swear
I've seen this in at least 2 other newsgroups. If you post it to
multiple
groups, do it all at once rather then doing each one individually.
This
way,
if someone in one group responds, the people in the other groups know
and can respond appropriately.

That said, I agree with the response in the other group, REM's are
old
hat,
replace with single quote. And take out the End statement.

How is the Directories_Change event being invoked? Is that set in the
designer and it's a listbox or something like that?

My guess would be that the events are assigned to the controls called
[Drives], [Directories] and [Files], and coded that way, so if you
have
[drives2], [directories2], and [files2], they don't fire the same
events
because they have a different name.

Just for grins, delete the 2's, then select the original ones, do a
Cut,
click on the group control, then do a paste to paste them inside it.

Another (safer) way to do this it to display the Document Outline,
which
shows all the controls and what containers they are (or aren't) in,
and you can drag them from one container to another. To see that,
View/OtherWindows/DocumentOutline.

Then run it, and see if it works.

Robin S.
--------------------------------------------------
"Scanboy" <Sc*****@discussions.microsoft.comwrote in message
news:8E**********************************@microso ft.com...
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.




Jan 26 '07 #6

P: n/a
It's not a problem posting to multiple newsgroups, just try to post all
of them at once. If someone sees a question in a newsgroup, and they
spent a lot of time trying to figure out an answer, then post it, it's
annoying
when they then see the same question in another newsgroup, answered
2 hours earlier. They could have spent that time helping someone else,
or taking their friends out for ice cream, or going to the movies... ;-)

Good luck.
Robin S.
------------------------------------
"Scanboy" <Sc*****@discussions.microsoft.comwrote in message
news:5B**********************************@microsof t.com...
Robin,

By the way, I am not a regular on these ngs. Didn't know what ngs are
out there, so I just looked for ones that I thought were appropiate
for my
posts.

Besides, I am using mum's computer, which does not have a newsreader
installed whereas I have Newsrover installed on mine, so I am replying
to
this via Microsoft's online web-based Usenet browser.
SB
-----------------------------------------------------------------------------------
"RobinS" wrote:
>Next time, *cross-post* rather than *multi-post* your message. I
swear
I've seen this in at least 2 other newsgroups. If you post it to
multiple
groups, do it all at once rather then doing each one individually.
This
way,
if someone in one group responds, the people in the other groups know
and can respond appropriately.

That said, I agree with the response in the other group, REM's are
old
hat,
replace with single quote. And take out the End statement.

How is the Directories_Change event being invoked? Is that set in the
designer and it's a listbox or something like that?

My guess would be that the events are assigned to the controls called
[Drives], [Directories] and [Files], and coded that way, so if you
have
[drives2], [directories2], and [files2], they don't fire the same
events
because they have a different name.

Just for grins, delete the 2's, then select the original ones, do a
Cut,
click on the group control, then do a paste to paste them inside it.

Another (safer) way to do this it to display the Document Outline,
which
shows all the controls and what containers they are (or aren't) in,
and you can drag them from one container to another. To see that,
View/OtherWindows/DocumentOutline.

Then run it, and see if it works.

Robin S.
--------------------------------------------------
"Scanboy" <Sc*****@discussions.microsoft.comwrote in message
news:8E**********************************@microso ft.com...
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.




Jan 26 '07 #7

P: n/a
Guyz,

This is the Scanboy here again.

I have just had a "D'oh!" moment here.

I have been a bit stupid. The problem is with (the following are all on one
line):-

Private Sub Drives_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs)

and:-

Private Sub Directories_Change(ByVal sender As Object, ByVal e As
System.EventArgs)

All I needed to do was to add:-

Private Sub Drives_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Drives.SelectedIndexChanged

Private Sub Directories_Change(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Directories.Change

which fixed the problem. I am at a loss as to how and why the 'Handles'
part somehow got left off.
SB
------------------------------------------------------------------------------------------------

"Scanboy" wrote:
>

"Scanboy" wrote:
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.


The work-around is this:-

1. Drop a label control on the form.

2. Set the 'AutoSize' property of the label control to FALSE.

3. Set the 'BorderStyle' property of the label control to 'Fixed3D'.

4. Make the 'Text' property of the label control an empty string.

5. Then position the 'Drives', 'Directories' and 'Files' controls so
that they appear to be inside the label. Resize the label if
necessary to accomodate the controls.

6. If you want the label's border around the 'Drives', 'Directories'
and 'Files' controls to have a title, drag another label control onto
top of the first label control and position the second label control
over the first label control so that the border around the 'Drives',
'Directories' and 'Files' controls appears to have a title, in a similar
fashion to the Frame control in VB 3.0 / 4.0 / 5.0.

7. Set the 'Text' property of the second label control to whatever
you like.

8. When you run the project, all you see is what appears to be a 3D
border around the drives, directories and files, with a title.

Nobody is any wiser, but only you know different.
Jan 27 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.