Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 10-31-2009, 10:51 PM   #1
Daemon Poster
 
Join Date: Oct 2006
Posts: 684
Default adding file path to listbox

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
__________________

__________________
AMD 64 x2 5600+|Asus m3a|4GB RAM|Nvidia Geforce 9500 gt|320 GB Seagate Hard Drive
ringtemek is offline   Reply With Quote
Old 11-02-2009, 03:22 PM   #2
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: adding file path to listbox

Quote:
i want to know how to add file paths to a listbox with a button-solved
Um... what?

Quote:
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".
__________________

berry120 is offline   Reply With Quote
Old 11-02-2009, 05:41 PM   #3
Daemon Poster
 
Join Date: Oct 2006
Posts: 684
Default Re: adding file path to listbox

Quote:
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)
__________________
AMD 64 x2 5600+|Asus m3a|4GB RAM|Nvidia Geforce 9500 gt|320 GB Seagate Hard Drive
ringtemek is offline   Reply With Quote
Old 11-03-2009, 07:28 PM   #4
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: adding file path to listbox

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.
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 02:36 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0