Click here to Skip to main content
16,023,117 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can somebody tell me how to get the all the values from Listbox to a variable?
Posted

Iterate over the Items property, then you can do whatever you want with each item in the list to "get it into a variable".
 
Share this answer
 
In addition to the other (correct) answer, you should buy a basic winforms book and read it, b/c for every question you think to ask, there's something basic that you don't even realise you don't understand.
 
Share this answer
 
And I notice you've asked this twice. What was wrong with your first answer ?
 
Share this answer
 
I dont wanted to bother people with a lot of code thats why.Sorry
 
Share this answer
 
v2
The answer code is:


For Each item In lsFoodandBaverages.Items
ps = item.ToString
Next


Where ps is global variable
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900