current cell in datagrid isn't saved!

G

Guest

hi,
I have a datagrid binded to a datatable and a save button..
everything works fine except the following scenario:
1. user enters a value
2. after that user clicks the save button but without moving from the
current cell in datagrid

all the changes are saved except the current edited cell.
 
G

Grzegorz Danowski

U¿ytkownik "Ahmed said:
hi,
I have a datagrid binded to a datatable and a save button..
everything works fine except the following scenario:
1. user enters a value
2. after that user clicks the save button but without moving from the
current cell in datagrid

all the changes are saved except the current edited cell.

Use EndCurrentEdit method of appriopriate currency manager, for example:
this.cmCustomers.EndCurrentEdit();

Regards,

Grzegorz
 
G

Guest

please do excuse my ignorance, but I am having the same problem and I
honestly don't know what a currency manager is :\

the user plays around on a Datagrid and then clicks on the "save" button
which does:

myDataAdapter.Update(myDataset)

I then go and check the DB and the row that was selected on the Datagrid
when the user pressed "save" isn't updated.

what's the simple solution to this?
 
G

Guest

Hi LunaNera,

There should some kind of sunchronization among data bound controls in
windows forms. The entity that does this is the curreny manager. For every
data source in a form, there exists at least one currency manager object.
The BindingContext object is another entity that lets you get the
CurrencyManager for a specific datasource.

The following great articles will help you
http://msdn.microsoft.com/library/d...n/html/vbconconsumersofdataonwindowsforms.asp

http://msdn.microsoft.com/library/d...s/vbcon/html/vboridatabindingwindowsforms.asp

Let me know if I could be of more help.

HTH,
Rakesh Rajan
 
G

Guest

Unfortunately, it doesn't solve the problem, however, I noticed the
following. If I put my saving code in a button, the code works!, but if the
code is written in a toolbar button, it doesn't work.???

I made a very simple project for this purpose:
1. added a dataadapter and dataset using designer tools
2. added a datagrid, button and a toolbarbutton to the form
3. in the load event I called fill method of the dataadapter.
4. I wrote the the same saving code in both button and toolbarbutton.
and the problem appears only in case of toolbarbutton and not the button??
 

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