databinding and controls
-
I have two controls on a form - checkBox1 and textBox1. When user "checks" checkBox1, textBox1 becomes visible. Looks pretty simple :o) 1. without databinding: textBox1.visible=checkBox1.checked This works great. 2. let's play with some data in dataset: I have bound "Checked" property of checkBox1 to a field in DataSet/DataTable. This field is also bounded to textBox1.visible property. Result: checkBox1 needs to lost focus to update data in dataTable, so user needs to "check" and next click into some other control. What should i do to make it working properly (immediately)? thanks h. btw: I have also tryed to force focus changes on the form (this.select(...)). The checkBox needed 2 mouse clicks to synchronize its state with dataset and since then, everything was fine :o)
-
I have two controls on a form - checkBox1 and textBox1. When user "checks" checkBox1, textBox1 becomes visible. Looks pretty simple :o) 1. without databinding: textBox1.visible=checkBox1.checked This works great. 2. let's play with some data in dataset: I have bound "Checked" property of checkBox1 to a field in DataSet/DataTable. This field is also bounded to textBox1.visible property. Result: checkBox1 needs to lost focus to update data in dataTable, so user needs to "check" and next click into some other control. What should i do to make it working properly (immediately)? thanks h. btw: I have also tryed to force focus changes on the form (this.select(...)). The checkBox needed 2 mouse clicks to synchronize its state with dataset and since then, everything was fine :o)
This has popped up several times this week. It is rather annoying (not u, the problem :)) You will need to do something like this depending on your databinding:
control.DataBindings[0].BindingManagerBase.EndCurrentEdit();
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02 -
This has popped up several times this week. It is rather annoying (not u, the problem :)) You will need to do something like this depending on your databinding:
control.DataBindings[0].BindingManagerBase.EndCurrentEdit();
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02You're right two times in one answer: 1. This problem is REALLY annoying. :o) 2. This method works well - I have tested 3 different binding modes. There is just one small thing - it needs two more clicks on checkbox to "synchronize". Should I open the row for editing? I have tried to use BeginEdit() method on current row, but there was no difference. I think, that may be a point, but have no idea how to solve it. Thanks for help h.