Wednesday 23 January 2013

VB.Net Arrays & Booleans

VB.Net Arrays & Booleans

Getting Started with Arrays. Simple Arrays:

Dim TempStringArray() As String = Split("Name1,Name2,Name3", ",")

' Result, TempStringArray(0) = "Name1", TempStringArray(1) = "Name2", TempStringArray(2) = "Name3".

Arrays start at 0 so a array of (Arrays(3)) Length is 4...

Booleans are very helpful.

Boolean can have 3 responses (True, False, Nothting(Null) or VbNull)

you can have an Array of any Object Types... etc

Dim TempIntArray(9) As Integer

' Getting the Length of a Array, there are to ways, Ubound() = the Length - 1
' Or TempIntArray.Length = 10
' Example:

' Ubound(TempIntArray) = 9
' TempIntArray.Length = 10

etc...

For I As Long = 0 To Ubound(TempIntArray)
TempIntArray(i) = i
Next

No comments:

Post a Comment