hii, guyz i wanted to learn how to declare and and use one and two dimensional array can any body give me a guidance through an eg.

Recommended Answers

Google: vb.net 2d array tutorial OR vb.net multidimensional array tutorial

Jump to Post

All 2 Replies

Google: vb.net 2d array tutorial OR vb.net multidimensional array tutorial

            Dim numberOfElements As Integer
            numberOfElements = 2 'Remember that if you define an array with TWO elements, it's 0 and 1 for VB, so you'll start counting from 0. Don't forget this. This array has ONE dimention
            Dim myArray(numberOfElements) As String 'Dim + name(elements) + As + data type
            myArray(0) = "Bits" 'To use it, write the array's name with the number of the element between() = "value"
            myArray(1) = "Anything you want to put here"
            Dim anotherDimensionedArray(3, 3) As String 'This is a 3x3 array
            Dim anotherArray(,) As String 'Here I don't specify the number of elements, but by writing the comma I tell to VB that it will has two dimensions.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.