Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I saw a question about the following posted here in March (showed up in first Google hits). The answer was a tricky thing (just wasted an hour on it due to poor support on DirListBoxes), so I thought I'd add the answer here as a reference.
The original question was how to make a DirListBox set a folder like a user would by doubleclicking on it.
The answer is: by setting the DirListBox's path to the path of the selected line, but that wasn't straightforward, so here is the VB.NET code for doing that:
-----(( START ))dim zObject as Object, zString as String
zObject = DirListBox1.DirList(DirListBox1.DirListIndex)
zString = zObject.ToString
DirListBox1.Path = zString
-----(( END ))
You can do
zString = DirListBox1.DirList(DirListBox1.DirListIndex)
if you want, but the above code is 'cleaner'.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |