Problems with databinding in winforms

E

esakal

Hello,



I have a very strange problem which involve databinding in winform
c#.net 2 .

I have a user control which holds textbox inside.

the user control has property which reflect the inner textbox text
property :

[Bindable(true)]

public string Content

{

get { return textBox1.Text; }

set { textBox1.Text = value; }

}



when the user click on a specific key (in the example attached the key
'enter'), the active control is changed using the method '.select()'.

In the example attached you can see the flow of my application. when
the user click on enter, i perform 'writevalue' of the relevent binding
to the dataset. then i change the active key using 'select()' method.

in my real application, after i leave the control using the 'select()'
the dataset value is cleared for unknown reason.

meaning, when i do the 'writevalue' i can see in debug that the value
is inserted to the dataset. but after the new control get the focus,
the dataset value returns to it's old value and doesn't contain new
value.

THIS PROBLEM OCCURS only when i use the custom key to move from my
active control. when i use the TAB key then the data remains in the
dataset.



I added the solution example even when in this solution the flow works
ok (you can see the when pressing 'enter' in my example, the data is
shown in the second control.

Please help.
 

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