How to use Array.SetValue() method to set a value to element at specified position in 1D, 2D and 3D Array in VB.NET

3 Answers

0 votes
Module Module1

    Sub Main()

        Dim arr(5) As String

        arr.SetValue("two", 2)
        Console.WriteLine("arr(2): {0}", arr.GetValue(2))

    End Sub

End Module

' run:
' 
' arr(2): two

 



answered Apr 30, 2016 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim arr2D(5, 5) As String

        arr2D.SetValue("two-three", 2, 3)
        Console.WriteLine("arr2D(2,3): {0}", arr2D.GetValue(2, 3))

    End Sub

End Module

' run:
' 
' arr2D(2,3): two-three

 



answered Apr 30, 2016 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim arr3D(6, 5, 4) As String

        arr3D.SetValue("one-two-three", 1, 2, 3)
        Console.WriteLine("arr3D(1,2,3): {0}", arr3D.GetValue(1, 2, 3))

    End Sub

End Module

' run:
' 
' arr3D(1,2,3): one-two-three

 



answered Apr 30, 2016 by avibootz
...