Windows Develop Bookmark and Share   
 index > Windows Forms General > Add listbox by using for/next
 

Add listbox by using for/next

Hi i'm pretty novice at this but we are making a "online shop" in VB as a examation project and I could need som help by adding my listboxitems by next/for. I have tried and now i am verry pissad at the program. Anyone can help?

this is how i have written:
Dim listboxitems As String
Dim i As Integer = 0

listboxitems = _
"Tippmann Custom 98 ACT" And _
"Tippmann Custom 98 ACT Cammo" And _
"Tippmann A5 Basic Cammo" And _
"Tippmann XT E" And _
"Tippmann Custom Pro ACT" And _
"Ion SP8 Total" And _
"BT-4 Assault Cammo" And _
"Spyder VS2" And _
"Startpaket Spyder Imagine RE"

listbox1.Items.Clear()

For i = 1 To 10
listbox1.Items.Add(listboxitems)
Next i



Bengt Erik  Saturday, February 02, 2008 11:31 AM
You can do it with an array:

Code Snippet

Dim items() as String = {"Tippmann Custom 98 ACT", ..., "Startpaket Spyder Imagine RE"}
listbox1.Items.Clear()
Dim i as String
For Each i in items
listbox1.Items.Add(i)

Next i




Regards
Marcel Nita  Saturday, February 02, 2008 8:58 PM
You can do it with an array:

Code Snippet

Dim items() as String = {"Tippmann Custom 98 ACT", ..., "Startpaket Spyder Imagine RE"}
listbox1.Items.Clear()
Dim i as String
For Each i in items
listbox1.Items.Add(i)

Next i




Regards
Marcel Nita  Saturday, February 02, 2008 8:58 PM

You can use google to search for other answers

Custom Search

More Threads

• How to access List<T> in Form1 from Form2 code?
• How to change the look of the windows scroll bar (not wpf!)?
• Add Textbox,Dropdown in Gridview
• Dock
• GridView Related Stuff
• Windows From top right corner buttons (c#)
• NDoc Issues
• Semi-transparent background form with opaque icons
• Tab Control tooltip
• Change the localization language at runtime