VB: EndEdit won't save, PositionChanged does

  • Thread starter Thread starter Brian Link
  • Start date Start date
B

Brian Link

I whipped up a form using the dataform wizard. I have three records.
If I make changes to a record and run my Save routine, I'll call the
EndEdit method on the dataset, then Update. In this case, the record
does not save successfully.

If I navigate to another record using the wizard-generated buttons, my
changes will be saved. What am I missing here?

Brian Link, Minnesota Countertenor
 
Hi Brian,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you were unable to save data on a
dataform wizard generated form with your own code. If there is any
misunderstanding, please feel free to let me know.

In your last post, you mentioned that you were calling EndEdit method on
the DataSet. However, as far as I know, DataSet doesn't have such method.
Are you calling the EndEdit on the DataRow or calling EndCurrentEdit on
CurrencyManager?

Based on my experience, the failure of EndEdit calling might be caused by
getting an incorrect binding context from the data source. Please make sure
you have given the correct data source, data member and property name for
the binding context.

HTH. If the problem persists, could you please paste your code here?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Brian,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you were unable to save data on a
dataform wizard generated form with your own code. If there is any
misunderstanding, please feel free to let me know.

In your last post, you mentioned that you were calling EndEdit method on
the DataSet. However, as far as I know, DataSet doesn't have such method.
Are you calling the EndEdit on the DataRow or calling EndCurrentEdit on
CurrencyManager?

Based on my experience, the failure of EndEdit calling might be caused by
getting an incorrect binding context from the data source. Please make sure
you have given the correct data source, data member and property name for
the binding context.

HTH. If the problem persists, could you please paste your code here?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Thanks Kevin. The command I use after my edits is

Me.BindingContext(DsEnt1.EX_Entity_Insurer).EndCurrentEdit()

Where DsEnt1 is my dataset, EX_Entity_Insurer is my datatable. I'll
try a couple different configurations.

BLink
 
Hi Brian,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you were unable to save data on a
dataform wizard generated form with your own code. If there is any
misunderstanding, please feel free to let me know.

In your last post, you mentioned that you were calling EndEdit method on
the DataSet. However, as far as I know, DataSet doesn't have such method.
Are you calling the EndEdit on the DataRow or calling EndCurrentEdit on
CurrencyManager?

Based on my experience, the failure of EndEdit calling might be caused by
getting an incorrect binding context from the data source. Please make sure
you have given the correct data source, data member and property name for
the binding context.

HTH. If the problem persists, could you please paste your code here?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

You were correct in your guess, but translating it into useful
information was quite difficult for me. It was only by Googling this
group, looking for EndCurrentEdit complaints that I hit on something
useful.

I created the databindings using the property grid (which I should
really wean myself away from) so they were written to the module as:

Control.DataBindings.Add("Text", dsDataSet, "TableName.ColumnName")

However, when updating I was using the syntax

BindingContext(dsDataSet.TableName).EndCurrentEdit()

This, apparently (and very subtly) is not the same bindingcontext as
the one used to bind the controls. Changing the preceding statement
to:

BindingContext(dsDataSet, "TableName").EndCurrentEdit

Preserves my data nicely.

Whew. Just goes to show you an elegant paradigm in the language
doesn't always make for intuitive programming. =P

Brian Link, Minnesota Countertenor
 
Hi Brian,

It was nice to hear that you have had the problem resolved. Thanks for
sharing your experience with all the people here. If you have any
questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top