Groups | Blog | Home
all groups > dotnet windows forms databinding > august 2004 >

dotnet windows forms databinding : Bound controls changing .text problem



Maurice Mertens
8/3/2004 3:09:58 AM
Hi,

a question about bound controls on the form:

I'm having a form with bound controls, i.e. Data1, Data2, Data3. When the
user changes the value in Data1 the values in Data2 and Data3 need to be
calculated and entered automaticaly.

I tried to use code like this:
me.Data2.text = clng(me.Data1.text) /2
me.Data3.text = clng(me.Data1.text) /3

After I use the row.endedit command, the values of Data2 and Data3 return
to their original value in the row. It seems like the changes made to the
..text property of the controls don't change in the underlying datarow.

How can I solve this problem?


--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering


Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
Sijin Joseph
8/8/2004 2:16:33 PM
You need to use the Format event of the binding object in the controls bound
to Data2 and Data3 ; in the event handler for the Format event you will have
to change the value like e.value = e.value/2 etc.

Refer to MSDN documentation on the Binding class and the Format and Parse
events.
--
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph


[quoted text, click to view]

AddThis Social Bookmark Button