ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

33- Arrays

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.

 

 

Example:

Let’s begin:

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.
    01_helloworld
  • The New Project dialog will appear.
    create2s
    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.
    arrayf1
  • Add the following code in the code editor.
    1. 'declare array as a string with six index
    2. Dim tagline(6) As String
    3. 'assigning values to an array
    4. tagline(0) = "itsourcecode.com"
    5. tagline(1) = " We Exist to Provide"
    6. tagline(2) = "Best Quality"
    7. tagline(3) = " and 100% Free"
    8. tagline(4) = " Source Code"
    9. tagline(5) = "and"
    10. tagline(6) = "Tutorials!"
    11. 'retrieving value of an array
    12. MsgBox(tagline(6))

 

Press f5 to run your project.

Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!