"Usually, you cannot call a procedure with more arguments than the procedure declaration specifies. When you need an indefinite number of arguments, you can declare a parameter array, which allows a procedure to accept an array of values for a parameter. You do not have to know the number of elements in the parameter array when you define the procedure. The array size is determined individually by each call to the procedure."
From http://msdn.microsoft.com/en-us/library/538f81ec%28v=VS.100%29.aspx
Showing posts with label Array. Show all posts
Showing posts with label Array. Show all posts
Sunday, April 17, 2011
Wednesday, November 3, 2010
Looping through an enum
Basic class containing the enum:
Public Class WeightUnits
Enum ItemWeightUnits
gms = 1
kgs = 2
mls = 3
ltr = 4
End Enum
End Class
An instance of the WeightUnits class is not required as the enum is shared by default.
Loop through the enum and get the NAMES of each entry in the enum.
Dim items As Array
items = System.Enum.GetNames(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Loop through the enum and get the VALUES of each entry in the enum.
Dim items As Array
items = System.Enum.GetValues(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Public Class WeightUnits
Enum ItemWeightUnits
gms = 1
kgs = 2
mls = 3
ltr = 4
End Enum
End Class
An instance of the WeightUnits class is not required as the enum is shared by default.
Loop through the enum and get the NAMES of each entry in the enum.
Dim items As Array
items = System.Enum.GetNames(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Loop through the enum and get the VALUES of each entry in the enum.
Dim items As Array
items = System.Enum.GetValues(GetType(WeightUnits.ItemWeightUnits))
Dim item As String
For Each item In items
MsgBox(item)
Next
Loop 1
Loop 2
Loop 3
Loop 4
Labels:
Array,
Constant Values,
Enum,
For Each,
Loop,
Visual Basic
Wednesday, October 27, 2010
What is an array?
An array is a list of values referred to by a single name. Arrays make it easy to access a list of related values. They can store lists of names, values or objects. Whenever you want to hold a list of values in memory for further processing or display, an array is an appropriate data structure.
Some terminology
Index
An index is a numbered position within the array. An array index begins at zero(0)
UpperBound
The UpperBound is the maximum index in an array.
Element
An element is the value (or object) contained within an index.
Note the difference
While the UpperBound & the Length of an array sound very similar, they are not the same at all.
Some terminology
Index
An index is a numbered position within the array. An array index begins at zero(0)
UpperBound
The UpperBound is the maximum index in an array.
Element
An element is the value (or object) contained within an index.
Note the difference
While the UpperBound & the Length of an array sound very similar, they are not the same at all.
Arrays
An array is an indexed list of related information of the same data type. One way to think of an array is list of variables of the same data type.
Each position in the array is called an Index. Indexes begin at zero (0).
A declaration statement is used to declare the existence of the array. It is defined as a particular data type. Each index may then be assigned a value.
Syntax
Dim ArrayName() As DataType
Dim intTopScore() As Integer = {23000,23500,23070,23008,23708}
The example above is an array of 5 integers. The first integer sits at Index zero (0) and the last integer sits at Index four (4).
Each position in the array is called an Index. Indexes begin at zero (0).
A declaration statement is used to declare the existence of the array. It is defined as a particular data type. Each index may then be assigned a value.
Syntax
Dim ArrayName() As DataType
Dim intTopScore() As Integer = {23000,23500,23070,23008,23708}
The example above is an array of 5 integers. The first integer sits at Index zero (0) and the last integer sits at Index four (4).
Subscribe to:
Posts (Atom)







