Things You'll Need:
- VB.net
-
Step 1
Open in VB.net.
-
Step 2
New ProjectCreate a new proejct.
-
Step 3
ListboxAdd a listbox to the form.
-
Step 4
ButtonAdd a button to the form.
-
Step 5
Code WindowDouble click the button to bring up the button's click event code window.
-
Step 6
CodeIn the code window we create a FOR-NEXT loop to add a list of numbers. Then to add items to the listbox we use the "ListBox1.Items.Add i". See the picture for the exact code.
-
Step 7
Press the "F5" key on your keyboard to run the program.
-
Step 8
Final ResultsClick the button on the form and you will see the numbers added to the listbox.
















Comments
mpodlesny said
on 11/5/2008 this example is just that an example.
josinathan said
on 11/4/2008 i have a problem by using this code, that is if i close the application and reopen it the added item does not present in that purticulur Listbox what i have to do
luv2blog said
on 10/12/2008 Thanks for the info.
argyle said
on 10/7/2008 I get this question all the time from newbies. I hope they all find their answer here next time! Thanks for the article.