Listbox Items

tonycrew

Well-known member
Joined
Apr 20, 2009
Messages
55
Programming Experience
Beginner
Hello, We have a button, textbox and a folder browser...

We made it so that when you click the button it shows the folder browser dialog.. And you choose your folder/path, then it shows the selected path in textbox.. We are succesful on this.. But now weve added a listbox, And when you selected the path it will do this..

VB.NET:
ListBox4.Items.AddRange(My.Computer.FileSystem.GetFiles(TextBox45.Text))

Which is adding the files from that directory into the listbox in items..

But its not work it comes up with The blue scribbly line

Get the (Overload Resolution Failed Error)

..?
Please help, Thanks!
 
That's because the ListBox doesn't take a collection like that, you have to convert it to an array first:
VB.NET:
ListBox4.Items.AddRange(My.Computer.FileSystem.GetFiles(TextBox45.Text).ToArray)
 
Back
Top