What is an Array? Array is a sequence of objects that has similar type and size. Every object inside an array is defined as the element of an array. It’s either you have an array of strings or characters, integers or any that has defined data type.
The main purpose of an array is to organize identical data together as a team to execute operations on data in a collective manner.
Take note that arrays is accessed by their index number and it always starts from zero.
- Open the Visual Basic, select “File” on the menu, hit new and create a new project.
- The New Project dialog will appear.
Select “windows” in the project types, hit the “windows form application” in the templates and hit “ok“.
- In the toolbox, select a button and drag it into the form.
- Add the following code in the code editor.
- 'declare array as a string with six index
- Dim tagline(6) As String
- 'assigning values to an array
- tagline(0) = "itsourcecode.com"
- tagline(1) = " We Exist to Provide"
- tagline(2) = "Best Quality"
- tagline(3) = " and 100% Free"
- tagline(4) = " Source Code"
- tagline(5) = "and"
- tagline(6) = "Tutorials!"
- 'retrieving value of an array
Press f5 to run your project.