VB.NET Tutorial – List Collections – Adding, Retrieving, and Removing Data (Visual Basic .NET)

In this Visual Basic .NET tutorial, I will be demonstrating how to easily add, retrieve, and delete data from a VB List array. I’ll also be showing you various looping methods used to access the collection data and return it to a ListBox.

Collections – List Of String, List Of Integer
Loops – For Each, For X = (Index Count), List.ForEach method
Form Controls – TextBox, ListBox, Button
Subs & Variables

TIP JAR: http://www.aardaerimus.com/tipjar.asp


tekila gerila says:


exocrypton says:

Is it possible that other members can also add(view, etc.) strings to the list?

Brown Stamp says:

Thank you for ur guiding, It is really helpful to the beginner of Visual base like me.
I have saw this code before when i learning to make Mario for those uncountable monster. However i couldn’t make it clear how it works at that time.
Got a question,
I want to show out what is in the list anytime, so i make a timer tick to updating data to ListBox1..

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MyStrList.ForEach(AddressOf ListBox1)
End Sub

However, this doesn’t work. Have i do something wrong in this code? Or it is unthinkable to combine timer with list-out?

José Manuel says:

Thanks u!!!!!!!! Great job

Arsène Wenger says:

instead of a message box how does one show the contents of a list to a textbox

buddyroach says:

very good tutorial. easy to understand. thanks. i have a question though. i have a picturebox control which is part of a list collection. how do i reference it without referencing it tostring? i want to be able to change properties of the pictureboxes in the list.

dajo77 says:

Very nice, helped a lot! Say one already has some data that they would like insert into the list, how would you preload from a class in order to keep the main form more clean?

Wardude202 says:

Quick question, how do i remove a specific line from the list? what would be the code for that e.g say you have 3 different things in the list, and you want to remove the second one and replace it with something else, how do i go about doing that?

Carlos Alberto Araujo says:

Very good.
Once again… perfectly explained and made simple.
Only a question:
After saving the file to an executable, the items go within the executable ?  Also saved ?

Sergio Manuel Frias says:

Hi, how are you? I’ve got one question. Can this collection be used for containing all forms in the project(those closed or open). And would it be posible to show a chosen form? I’m trying to show some forms without using the openforms method because these forms aren’t open :(. Could you, please make a video tutorial to show that with a listbox?

Gabriel Market says:

Hi, do you know how to populate a string array with data from a sharepoint list. My goal is to populate a listbox in a windows form with this data every time a user uses the form. sorry if this is a dumb question I’m very new to vb

Manish kishore sharma says:

Really Really Nice Video. And i Would like to thank u sir for this….

Md. Momin says:

autocomplete textbox in vb.net

Gamal Abdall says:

This Techniques that you explained which is CollectionName.Foreach(addressof FunctionName) is really great, thank you teaching it to us, I really did not know that it exists.Thank you for those new things, its really helpful.

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!