RejectChanges on databinding control

I

inadsad

Hi Group,
I have a form with textboxe, maskedit controls including two
buttons (Add, Cancel). Controls are bound to a dataset as follows:

txtName.DataBindings.Add(New Binding("Text",
dDatasetA.Tables("Charge"), "Name"))
maskPhone.DataBindings.Add(New Binding("Value",
dDatasetA.Tables("Charge"), "Number"))

On load event I bring up an existing record and then press <Add> works
fine (clears name and number fields), and, <cancel> has the following
code:
dDataset.Tables("Charge").RejectChanges()

The difficulty I'm having is that RejectChanges doesn't restore number
field to the original value, name field works fine. The only
difference between above two line is the propertyname. Why Name
field, on rejectchanges, goes back to the original value and not the
number field?

Thanks
Ian
 
C

Cor Ligthert[MVP]

insade,

I would search in your case in another place. What happens with a change is
that the original field is stored in a seperated field. The rowstate (there
is only one rowstate) is set to changed. If you reject the changes then the
original fields are again set over the changed fields and the rowstate is
set to unchanged.

Cor
 
I

inadsad

insade,

I would search in your case in another place. What happens with a change is
that the original field is stored in a seperated field. The rowstate (there
is only one rowstate) is set to changed. If you reject the changes then the
original fields are again set over the changed fields and the rowstate is
set to unchanged.

Cor

Thanks Cor for the reply.

"I would search in your case in another place." meaning somewhere in
my codes
field number is being overwritten. Right now to make it work I have
to either
change propertyname on binding to "Text" or save it in a temp field.
Changing propertyname to 'Text' messes up the phone format. However,
rejectchanges restores the number field to its original state. I'm
still not sure why do I need to change propertyname to 'text' in order
to make it work. A short example would be helpful.

Thanks
Ian
 
I

inadsad

Sorry Cor - I forgot to mention in my previous post that it happens
only on
(.AddNew). If simply editing the number field and rejectchanges then
it works fine.
Only when adding (.addnew) the rejectchanges doesn't work on number
field with
propertname = 'Value'. I'd appreciate any help/ideas.

Ian
 

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