Find first in Visual Basic .NET

Find this useful? Support us: Star on GitHub 6
Category: Array | Language: Visual Basic .NET

In Visual Basic .NET, the first element of an array can be accessed using the index value 0. Here is an example of how to find the first element of an array in VB.NET:

Dim myArray As Integer() = {1, 2, 3, 4, 5}
Dim firstElement As Integer = myArray(0)

In this example, a new array "myArray" is declared with integers 1 through 5. The first element of the array is then accessed by assigning the value at index 0 to the variable "firstElement".

You can then use the "firstElement" variable in your code, or print it to the console to verify that the correct value was assigned.