From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add, remove, and interact with items from list

Add, remove, and interact with items from list - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Add, remove, and interact with items from list

- [Instructor] Some of the most common actions with generic lists are adding, removing, and accessing items in the list. By design a newly instantiated list contains zero items. That means the items I'm showing her on line eight and line nine, these two lists of Strings, contain zero items until I explicitly add an item to the list. There is a way to initialize the list when creating it by using the initializer syntax. That looks like this. After the new list of String type in an open and closed paranthesy and inside that an open and closed curly brace. Then you'll use a comma delimited list of items. I'm using a list of String, so inside the curly braces I'll use a delimited list of Strings like this. I've already got a breakpoint on line six. Let's see what this looks like. I'll hit my breakpoint by clicking on the Initialize button and step through my code by pressing F11 until I get down to this line, and you'll…

Contents