Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...

I am new to vb.net. 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 each with different Header. 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
600 700 800


datagridview-2

Col-D : Col-E : Col-F
1000 2000 3000
6000 7000 8000


datagridview-3

Col-A : Col-B : Col-C : Col-D : Col-E : Col-F Total
100 200 300 1000 2000 3000 (C+F)
600 700 800 6000 7000 8000 (C+F)


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


''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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900