Please help - DataGrid

  • Thread starter Thread starter KB
  • Start date Start date
K

KB

I realised that if I use datagrid and datasource is a
datatable, when I created a new row and while on that row
I exit the datagrid (ie. without moving into the next
row) and focus onto another control, that new row is not
recorded (check it at the datagrid.validating event).
However, if I use down arrow key to move to the next row
(without keying any data) and exit, the new row is
recorded in the datatable.
can anyone please advise if I can force the datagrid row
into the datatable without moving the arrow key ??

Thank you

AH
 
Good question. I cant find a way of doing this easily, but I am sure that
there is a way. However, I am interested to know why you would want to add
blank rows to your grid ?

OHM
I realised that if I use datagrid and datasource is a
datatable, when I created a new row and while on that row
I exit the datagrid (ie. without moving into the next
row) and focus onto another control, that new row is not
recorded (check it at the datagrid.validating event).
However, if I use down arrow key to move to the next row
(without keying any data) and exit, the new row is
recorded in the datatable.
can anyone please advise if I can force the datagrid row
into the datatable without moving the arrow key ??

Thank you

AH

Regards - OHM# (e-mail address removed)
 
Maybe there is a way. On the currentCellChanged event, you can compare the
rowIndex with the rows.count on the bound table. If the row is greater, you
could save it at this point.

Worth a try.

OHM

Good question. I cant find a way of doing this easily, but I am sure
that there is a way. However, I am interested to know why you would
want to add blank rows to your grid ?

OHM


Regards - OHM# (e-mail address removed)

Regards - OHM# (e-mail address removed)
 
hi, nice to know that I'm not the only one facing this
problem. re 1st question I did not create a blank row. I
actually key in data but cursor did not leave that row. I
realised it does not create that row in datatable until
you actual move the cursor to next row.

yes .. that could work but i believe that must be a
better way ... could any expert care to help? I do a
validating event and the set focus back to grid and next
validating event will create that row into the
datatable ... strange.. therefore I believe there must be
some event or method that can force the record into the
datatable.

Rgds,

AH
 
I wouldnt swear to it, but this may be how it was intended to work !

OHM

hi, nice to know that I'm not the only one facing this
problem. re 1st question I did not create a blank row. I
actually key in data but cursor did not leave that row. I
realised it does not create that row in datatable until
you actual move the cursor to next row.

yes .. that could work but i believe that must be a
better way ... could any expert care to help? I do a
validating event and the set focus back to grid and next
validating event will create that row into the
datatable ... strange.. therefore I believe there must be
some event or method that can force the record into the
datatable.

Rgds,

AH

Regards - OHM# (e-mail address removed)
 
Back
Top