Copy array elements from one array to another in VB.Net

In this article we will learn how to copy of element from one array to another array
  • 10032
 

In this we copy the element of one array to another array. In this Example We have a string with element 11, 22, 33, 43, 55, 66 and now we going to copy it to another array.

1. Open visual Studio

2. Create a project with console application with language VB.Net

3. Write the following code in the page

Module Tester
     Sub Main()
        Dim Values() As Integer = {11, 22, 33, 43, 55, 66}
        ' Declare the array

 
        Dim MyValues(6) As Integer
 
        Dim I As Integer
 
        For I = 0 To 5
            Console.Write(Values(I) & " ")
        Next
        Console.WriteLine()
         ' Copy one array to another
        ' Copy one array to another

 
        Values.CopyTo(MyValues, 0)
        For I = 0 To 5
            Console.Write(MyValues(I) & " ")
        Next
        Console.Read()
    End Sub

End
Module

Outputcopy-array.jpg of the Application

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.