datagrid view rows repeat data in all rows
hi every body i have a strange problem in my grid view when i fill my first row with data and move to the second row and after edit the second row and leave the row the data changed to the same as the previous row and so on all row which is edit change to the previous row how can i solve this problem this problem happened when i move with table enter arrows of keyboard
Gowtham KPosted May 30, 2015, 8:07 AM
alaaPosted May 29, 2015, 1:22 PM
Gowtham KPosted May 29, 2015, 9:19 AM
Gowtham KPosted May 29, 2015, 9:08 AM
alaaPosted May 29, 2015, 7:21 AM
if (dataGridView1.Rows[e.RowIndex].Cells[1].Value != null)
{
string cellValue = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
if (!string.IsNullOrEmpty(cellValue))
{
_bar = cellValue;
PopulateColumns();
dataGridView1.Rows[e.RowIndex].Cells[2].Value = _proname;
dataGridView1.Rows[e.RowIndex].Cells[3].Value = _price;
dataGridView1.Rows[e.RowIndex].Cells[4].Value = _unit;
}
}
i use PopulateColumns(); to access data from data table and pass it to the grid view where it equal dataGridView1.Rows[e.RowIndex].Cells[1].Value . when i use break-point it works correct if i stop break point it repeat the same data in each row despite the value of dataGridView1.Rows[e.RowIndex].Cells[1].Value is not the same ?
Gowtham KPosted May 29, 2015, 6:42 AM