1,105,232 Community Members

Insert selected Multiple rows from two DatagridView to another Datagridview

Member Avatar
ashublr
Newbie Poster
3 posts since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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 
Member Avatar
Begginnerdev
Veteran Poster
1,141 posts since Apr 2010
Reputation Points: 251 [?]
Q&As Helped to Solve: 191 [?]
Skill Endorsements: 15 [?]
 
0
 

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)

Member Avatar
ashublr
Newbie Poster
3 posts since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi...

Thanks for your fast reply.

both grid view are having the same row count.

And second & thirtd question i didnt understand...

Member Avatar
ashublr
Newbie Poster
3 posts since Jul 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

**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
You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article