You are on page 1of 3

DISCUSSION: At the end of this lab exercise, we have run the see how array function on V.B 2008.

Arrays occupy space in memory. The programmer specifies the array type and the number of elements required by the array so that the compiler may reserve the appropriate amount of memory. Arrays may be declared as Public (in a code module), module or local. Module arrays are declared in the general declarations using keyword. Local arrays are declared in a procedure using Dim or Static. Array must be declared explicitly with keyword "As". Array are for storing variable data in fixed or dynamic size. It can be programmed by programmer to make it fixed or not. For example, if we need to enter one hundred names, it is difficulty to declare 100 different names, this is a waste of time and efforts. So, instead of declaring one hundred different variables, we need to declare only one array. We differentiate each item in the array by using subscript, the index value of each item, for example name(1), name(2),name(3) .......etc. , which will make declaring variables streamline and much systematic. To do the array, we must first declare the array name and the data type. After that we must have number of element. As an example:- Dim Politeknik(15) As String. Politeknik is the variable array name. String is the data type for the array that mean it will store text. The number of element is 16 where its start from 0 to 15. Array can be set with unknown number. Just put the blank bracket after array name. Array usually can be on one dimensional and multidimensional array. A two dimensional array is a table of items that make up of rows and columns. The format for a one dimensional array is ArrayName(x), the format for a two dimensional array is ArrayName(x,y) and a three dimensional array is ArrayName(x,y,z) . Normally it is sufficient to use one dimensional and two dimensional array ,you only need to use higher dimensional arrays if you need to deal more complex problems. To simplify working with array, ubound (upper boundary) is use to check the top index of the array. With that, we can process array without refer the declaration statement of the project that define how many value the array can hold.
One dimensional Array Student Name(1) Name(2) Name(3) Name(4) Name(5) Name(6) Name Two Dimensional Array Name(1,1) Name(1,2) Name(1,3) Name(1,4) Name(2,1) Name(2,2) Name(2,3) Name(2,4) Name(3,1) Name(3,2) Name(3,3) Name(3,4)

CONCLUSION: In this lab exercise, we have run the array function on VB 2008. We have learn the function of array and the application on the VB. Actually, array is use to organize the variable number of data that will be keep by user. So the number of element sometime will be declare by programmer or it will be infinity. So array is use to organize the variable number of data. It have fixed and dynamic array. Two types of arrays in Visual Basic namely Fixed-size array. The size of array always remains the same-size doesn't change during the program execution. Dynamic array, The size of the array can be changed at the run time- size changes during the program execution.The number of element can be on the bracket ( ). To organize many number of array, two dimensional array is use. It will use combination of rows and column to get the data, different from one dimensional array. To simplify working with array, ubound is use to check the top index of the array.

REFERRENCES: Microsoft Visual Basic 2008(Step By Step) By Michael Halvorson http://www.vbtutor.net/vb6/lesson16.html http://msdn.microsoft.com/en-us/library/vstudio/wak0wfyt.aspx http://visualbasic.freetutes.com/learn-vb6/lesson6.html

You might also like