Computing.Net > Forums > Programming > VB.NET DirListBox

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB.NET DirListBox

Reply to Message Icon

Name: svg
Date: July 21, 2005 at 15:40:16 Pacific
Comment:

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'.



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB.NET DirListBox

How do I hide a form on load vb.net www.computing.net/answers/programming/how-do-i-hide-a-form-on-load-vbnet/4597.html

Vb .net www.computing.net/answers/programming/vb-net/13338.html

Vb.net www.computing.net/answers/programming/vbnet/4055.html