Two-way Databinding with Custom Control

G

Guest

I've created a custom control that inherits from TextBox. Everything has worked fine up to now. I bind a typed DataSet to my control and when I fill the DataSet, the appropriate record is loaded. I call BeginEdit on the row. Then I change the data in my app, and call EndEdit for the row. But when I look at the DataRow in the debugger, the data is the original data, not the changed data. If I use the default TextBox instead of my own, the new data is put in the DataRow when I call EndEdit and the database updates correctly. HasChanges knows that something has changed. There is a current row and an original row in the DataSet. I'm obviously missing something in my custom control but I can't figure out what. Does anybody have a clue?
 
M

Martin Rosén-Lidholm

I have exactly the same problem, only I use Infragistic's UltraTextEditor
instead of Microsoft's TextBox as the view, and Borland's ECO
ReferenceHandle instead of Microsoft's DataSet as the model.

So, if you found the solution, please post it here (or in the
microsoft.public.dotnet.framework.windowsforms.databinding NG).

Regards,
// Martin Rosén-Lidholm

sandman said:
I've created a custom control that inherits from TextBox. Everything has
worked fine up to now. I bind a typed DataSet to my control and when I fill
the DataSet, the appropriate record is loaded. I call BeginEdit on the row.
Then I change the data in my app, and call EndEdit for the row. But when I
look at the DataRow in the debugger, the data is the original data, not the
changed data. If I use the default TextBox instead of my own, the new data
is put in the DataRow when I call EndEdit and the database updates
correctly. HasChanges knows that something has changed. There is a current
row and an original row in the DataSet. I'm obviously missing something in
my custom control but I can't figure out what. Does anybody have a clue?
 

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