Hi..

I am newbe in vb.net. I am creating a small project for students. I need a help.

I have three DataGridView on my form.And I am importing the data from the csv to datagridview1 and datagridview2 and have 5 columns in first and second with different names. Now I need to copy first row cell calues from datagridview1 and datagridview2 to datagridview3 in the first row only. How can i perform this.

         datagridview-1                      

       Col-A : Col-B : Col-C   
        100     200     300 

         datagridview-2  
      Col-D : Col-E : Col-F    
      1000     2000   3000

          datagridview-3
    Col-A : Col-B : Col-C : Col-D : Col-E : Col-F 
     100      200      300   1000    2000    3000 

Some questions before code can be written:

Do both gridviews contain the same row count for data?

Have you tried reading in from both csv files, concatinating them together for the third gridview?

Is it possible that you are placing more controls on the form than are needed? (See question 2)

Hi...

Thanks for your fast reply.

both grid view are having the same row count.

And second & thirtd question i didnt understand...

**Hi...

Thanks for your fast reply.

both grid view are having the same row count.

And second & thirtd question i didnt understand...
**

The code which I am using to import CSV file to DATAGRIDVIEW.

    If System.IO.File.Exists(EquityReport) Then
        ReportListBox1.Items.AddRange(System.IO.File.ReadAllLines(EquityReport))
    End If

    RemoveDuplicates()

    ''Code is responsible for updating the Filtered data to CSV
    Dim myCoolWriter As New IO.StreamWriter(EquityReport)

    For Each coolItem In ReportListBox1.Items
        myCoolWriter.WriteLine(coolItem)
    Next

    myCoolWriter.Close()

    ReportListBox1.Update()


    Dim dt As New DataTable


    For Each line As String In System.IO.File.ReadAllLines("C:\TrendZ-Master\EquityReport.txt")

        DataGridView1.Rows.Add(line.Split(";"))
    Next

    For Each line As String In System.IO.File.ReadAllLines("C:\TrendZ-Master\EquityReport.txt")

        DataGridView2.Rows.Add(line.Split(";"))
    Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.