commit changes earlier

G

Gav

Hi all,

I have a datagrid which is populated by a dataset, I have some code to
update the database etc... If I enter a value into the datagrid and hit the
save button it saves the old value not the one just entered, I have to make
sure I take the focus from the cell and wait a few seconds before i save it.

Is there a way i can speed this up so it saves the correct value?

Thanks
Gav
 
N

Nicholas Paldino [.NET/C# MVP]

Gav,

You don't have to wait a few seconds, you should just shift focus from
the cell.

Also, if you want to force the edit to complete, then you can get the
view on the current row being edited (through the currency manager for the
data source the grid is bound to) and call the EndEdit method on that. This
should commit the changes and cause the correct new value to be committed.

Hope this helps.
 
G

Gav

I still appear to be having problems with this... at the minute before I do
anything I loop through all the rows in the dataset and call EndEdit but
still I'm still not getting the correct value unless I change focus and
still wait a couple of seconds.

Anymore help would be much appreciated
Thanks
Gav

Nicholas Paldino said:
Gav,

You don't have to wait a few seconds, you should just shift focus from
the cell.

Also, if you want to force the edit to complete, then you can get the
view on the current row being edited (through the currency manager for the
data source the grid is bound to) and call the EndEdit method on that.
This should commit the changes and cause the correct new value to be
committed.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Gav said:
Hi all,

I have a datagrid which is populated by a dataset, I have some code to
update the database etc... If I enter a value into the datagrid and hit
the save button it saves the old value not the one just entered, I have
to make sure I take the focus from the cell and wait a few seconds before
i save it.

Is there a way i can speed this up so it saves the correct value?

Thanks
Gav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top