adding file path to listbox

ringtemek

Daemon Poster
Messages
684
I have vb 2008 and i want to know how to add file paths to a listbox with a button-solved

How do i convert a listbox to a string
 
i want to know how to add file paths to a listbox with a button-solved
Um... what?

How do i convert a listbox to a string
Again, what do you mean? There's no such thing as "converting" a list box to a string. You can get the text in the currently selected value, you can get an array of strings representing all the values... but that's not "converting".
 
Again, what do you mean? There's no such thing as "converting" a list box to a string. You can get the text in the currently selected value, you can get an array of strings representing all the values... but that's not "converting".

I type this code in and i get the error Error Value of type 'System.Windows.Forms.ListBox.ObjectCollection' cannot be converted to 'String'

Code:
Delete = New shredder(Me.ListBox1.Items)
 
It would be very helpful if you elaborated on what you were trying to do, but here is my best stab at it.

It sounds like you're trying to get all of the values from the listbox.

So:
Code:
Dim myValues As New Collections.Generic.List(Of String)

For Each aListItem As ListItem in Me.ListBox1.Items

    myValues.Add(aListItem.Value())

Next

Now you have all of the values in your listbox stored in myValues.

Hope this is what you're looking for.

Not sure what your Delete and shredder objects are though.
 
Back
Top Bottom