Hi,
I just need a little help here, I wanted to copy the rows in current form's datagridview to another form's datagridview.
Here is my example rows in datagridview1 in current row
ID | ProID | Name
1 | 1 | Shirt
2 | 1 | Shoes
3 | 2 | Pants
4 | 2 | Cap
What I want is when I selected shirt and click the button all rows with the same ProID as the selected row will be copied to another form's datagridview.
Here is my code but it only transfer the selected row and not all rows with the same ProID as the selected row. I don't have an idea on how to loop all rows to be copied.
Dim i As Integer = Promotion.DataGridView1.Rows.Count + 1
Promotion.DataGridView1.Rows.Add(i, DataGridView1.CurrentRow.Cells("PLU").Value, DataGridView1.CurrentRow.Cells("Barcode").Value, DataGridView1.CurrentRow.Cells("ItemName").Value, DataGridView1.CurrentRow.Cells("ItemPrice").Value, DataGridView1.CurrentRow.Cells("Description").Value)
yvrej17_1
0
Newbie Poster
Recommended Answers
Jump to PostI wonder if your code would ever compile and it certainly does not use two datagridviews.
Here is an example on how to loop through datagridviewrows
All 4 Replies
ddanbe
2,724
Professional Procrastinator
Featured Poster
yvrej17_1
0
Newbie Poster
ddanbe
2,724
Professional Procrastinator
Featured Poster
yvrej17_1
0
Newbie Poster
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.