Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple data binding to a property
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00828163
Message ID:
00828792
Views:
17
This is how I use databindings in c# for Winforms

this.Text1.DataBindings.Add(new Binding("Text",ds_clients,"clientdata.client_name"));

>>Hi, Steve.
>>
>>You may find something here:
>>www.bluevisionsoftware.com/WebSite/Books/CustomControlsAndDesigners/Samples/Chapter6.pdf
>
>Hey, Claudio, thanks!
>
>This revealed something more. This article states that (for simple binding) you can only bind to a public property, not a field (public or otherwise). Armed with this, I was able to bind a textbox to a property. I'd previously made the properties private figuring that they were in scope of the code that was doing the binding, but considering that ).
>
>However, for some reason it won't work with a ComboBox:
>
>cboShippers.DataBindings.Add("SelectedValue",this,"CboValue");
>
>
>Where "CboValue" is a public (Int32) property on the form (the ValueMember of the combo is set to an Int32 column). This at least yields a different error, "Object reference not set to an instance of an object".
>
>So what's not an object? this? It most certainly is! CboValue? Well, no it isn't - is it s'posed to be? <s>
>
>Thanks again.
Fred Besterwitch, MCP

The harder you work. The luckier you get.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform