By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,871 Members | 2,418 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,871 IT Pros & Developers. It's quick & easy.

data binding: using text and tags.

P: n/a
Greetings,

I have a combo box that I binded to a data set using text and tags. I
want it to display the DRT.Name property and have a DRT.UnitId as a
value.

this.drtComboBox.DataBindings.Add(new
System.Windows.Forms.Binding("Tag", this.drtDataSet1, "DRT.UnitId"));
this.drtComboBox.DataBindings.Add(new
System.Windows.Forms.Binding("Text", this.drtDataSet1, "DRT.Name"));
What I would like to do now is also bind a label with the same Tag
propertie and have it change automatically when the combobox is
changed. I want the tag to be binded to the same DRT.UnitID as the
combobox and have that ID updated when the combobox changes. I would
then like to use that ID to display any other value in the dataset
matching that ID number. In this case displaying the DRT.SerialNumber
value.

this.snValueLabel.DataBindings.Add(new
System.Windows.Forms.Binding("Tag", this.drtDataSet1, "DRT.UnitId"));
this.snValueLabel.DataBindings.Add(new
System.Windows.Forms.Binding("Text", this.drtDataSet1,
"DRT.SerialNumber"));

However, the text of the label never changes when the combobox is
changed. Is their a way to make this work?

I can get it to work by detecting a change in the combo box and then
grabing the value ( ID value) and doing a query using that ID for any
other property matching that ID number.

Is this the easiest way of doing this??

Thank you

Dec 14 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.