473,221 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

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

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
7 2788
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


"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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: martijn | last post by:
Probably not the first time this one is asked in this group... The standard filelistbox does what it says, it lists files. But as all windows based dialogs offer file details etc. I think it...
7
by: Martin | last post by:
Again drawing on the groups experience:- 1. For general file opening and file saving, using VB6, are there any issues with using the FileOpen and FileSave Common Dialog Boxes? 2. Is using the...
3
by: Mrkrich | last post by:
In VB.NET it doesn't have DirListBox control, I want to retrieve the directory name so I try to use OpenFileDialog/SaveFileDialog and like I guess it retrieve the file name not directory. Does in...
1
by: Vernon Gainous | last post by:
Does VB.NET have it's own set of controls for accessing the file system. VB6 had a DriveListBox, DirListBox, and FileListBox controls. Where are these controls for VB.NET?
10
by: kokirichild | last post by:
Hi All! I've been scouring the web to no avail, but what I'm looking for is something similar to the FileListBox that was there in VB6 but seems to have been removed (or moved) in 2005. Does...
0
by: akoymakoy | last post by:
how do i link my dirlistbox to the filelistbox viceversa... I would like to use the path of the file selected in the filelistbox as a variable that i would use as a location for the DB that i will...
9
by: =?Utf-8?B?U2NhbmJveQ==?= | last post by:
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....
0
by: supriya123 | last post by:
Hi, I have one c# windows application in which I am using a DirListBox control.Its working finely but I am not getting a way for retrieving the elements of the control. Like - If I want some ith...
0
by: Cancionero | last post by:
All, This is a simple problem that I, for some reason, am having a hard time with. Basically I am trying to rename all the files listed in a FileListBox based on a search and replace string. I...
2
by: VEnkatramasamy | last post by:
Hi, I am working in a upgradation of a VB project. I am reported with an issue that a drivelistbox does not show the mapped drives (it works properly on other operating systems except windows...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.