Hi,
My datagridview contains 3 columns, I have displayed values in these cells on the cell enter event, if the user do not enter any value in any of three cells, the new row is not added. The new row only get added if the value in written in any of the cell. So, what can i do to add a new row on the cell leave event of the last cell.
Thanks,
Vidya
Loading

Deepak Bhatia142 reputationPosted Oct 5, 2009, 10:06 PM EDT
Deepak Bhatia142 reputationPosted Oct 5, 2009, 8:54 PM EDT
Vidya Yadav22 reputationPosted Oct 5, 2009, 9:03 PM EDT
At the form load there will be one row, then when i will leave the last cell of the first row then there should be one row added.
Regards,
Vidya
Deepak Bhatia142 reputationPosted Oct 5, 2009, 9:18 PM EDT
Vidya Yadav22 reputationPosted Oct 5, 2009, 9:34 PM EDT
Regards,
Vidya
Deepak Bhatia142 reputationPosted Oct 5, 2009, 9:52 PM EDT
Vidya Yadav22 reputationPosted Oct 5, 2009, 9:53 PM EDT
Now only the problem is when the new row is added as it is the last row the focus leaves the datagridview and goes on other control the inserted the following line but didn't work now what can i do....
if (e.ColumnIndex == 9 && flagDoIt == true)
{
Thread t = new Thread(pAddRowInDatagrid);
t.Start();
flagDoIt = false;
}
private void pAddRowInDatagrid()
{
grdtreatment.Rows.Add(1);
grdtreatment.Focus();
}
I want that focus must be on the first cell of newly added row...
Thanks,
Vidya
Deepak Bhatia142 reputationPosted Oct 5, 2009, 10:02 PM EDT