ARTICLE

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

Posted by Brijesh Jalan Articles | Strings, Arrays in VB.NET August 13, 2010
In this article we will learn how to copy of element from one array to another array
Download Files:
 
Reader Level:

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

Outout of the Application

copy-array.jpg

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Diagram
Become a Sponsor