I have this declaration :
Private List() As Integer
I cant do like this:
List = 5
whats the way of assigning value to array one by one ?
That depends a bit on what version of VB you're using. In VB.Net I believe you can assign initial values in the statement which defines the array.
In VB6, you can't do that. You have to assign them one by one, or in some sort of looping structure such as a FOR loop.
But whatever version you're using, the whole point of an array is that you refer to the individual elements within it by their index number. For example, to assign the value 5 to occurence 1 you would say
It's worth noting that VB will always start the array at occurrence zero, unless you tell it otherwise. So for instance, if you defined List(5) the entries will actually be numbered from 0 to 5. Pretty stupid, but that's MS for you. I recommend always specifying the exact dimensions of the array. For example
Private List(1 To 5).