Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple data binding to a property
Message
From
15/09/2003 01:38:03
 
 
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00828163
Message ID:
00828900
Views:
25
Yep. I bound it in the Constructor. As for why it's a problem with binding Combos in the Load, it may have something to do with the fact that the SelectedIndexChanged event fires up a coupla times when you don't expect it to when you first instantiate a form. I've traced it before but all I remember now is that it's really strange, but I don't remember the exact sequence of when it fires. Could be that might have something to do with why it misbehaves a bit.

~~Bonnie


>>>It sounds like you've figured it out ok ... even the ComboBox will bind just fine to a property, as long as you're binding to an actual property and not a public field ... I don't know what your problem was though with your ComboBox example ... the stuff I just played with worked fine even if I didn't instantiate the field.
>
>Wow! Where are you doing the binding? I'm doing it in the Form_Load(). I still can't get mine to work.
>
>Also, I'm not sure what you meant by not instantiating the property...did you mean "initializing" the property?
>
>Ooh! Ooh! Hold da fone!!
>
>My question above got me wondering, and while I was successfully binding the TextBoxes in the Form_Load(), I couldn't do the same with the ComboBox. If I moved the line of code to bind the Combo to the form property to the CON-STRUCT-OR (after the InitializeComponent() call), it worked !!
>
>Interesting that while I had to do the Combo binding in the constructor, I could bind a textbox to the same property in the Form_Load, so that when selecting a different value in the combo, it's SelectedValue shows up in the TextBox.
>
>This really seems strange as the constructor fires before the Load(), and begs the question as to why it would have a problem binding in the Load() but not the constructor...
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform