ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 277.7k

Select row from datagridview1 not display in datagridview2 a

May 9 2018 6:26 PM
Problem
 
Select row from datagridview1 not display in datagridview2 and show wrong value  
 
IF I have two rows in datagridview1 and select second one it display as first meaning
if i have in datagridview1 two records
22
24
and select 22 first it move to datagridview2 success but 24 when select it from datagridview1 it display as 22 in datagridview2
why this idont know
I have two datagridviews
datagridview1 represent getselectrow
datagridview2 represent tbRes
my code as below in cell click event of first datagridview1
  1. IndexValSold = Grid.CurrentRow.Index;  
  2.             getselectrow = GetSelectedRowsVal();  
  3.             foreach (DataGridViewRow row in datagridview1.SelectedRows)  
  4.             {  
  5.                   
  6.                 tbRes.ImportRow(getselectrow.Rows[row.Index]);  
  7.                datagridview1.Rows.RemoveAt(row.Index);  
  8.                 //getselectrow.Rows.RemoveAt(row.Index);  
  9.   
  10.             }  
  11.             tbRes.AcceptChanges();  
  12.   
  13.             datagridview12.DataSource = tbRes;  
  14.             getselectrow.Rows.RemoveAt(IndexValSold);

Answers (2)