954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Changing label text from dataset

I have a combo box which is in set to be a drop down list. How do I change the label text based on which ID is selected in the combo box. How do I make the label text change to the corresponding row as the ID?

Thanks

functionalCode
Light Poster
32 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

I'm not sure what you're asking for. You can get/set the user value associated with a list/combo item.

You can add and remove items.

wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
 

I'm not sure what you're asking for. You can get/set the user value associated with a list/combo item.

You can add and remove items.

If I have a list of Names in the dataset and each have an ID and I have a combo box that displays the list of IDs. If I click an ID how to I get the label to show the name corresponding to that ID that was selected from the combobox.

Thanks

functionalCode
Light Poster
32 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

You click a listbox or combobox, it returns the index of that item.
You use that index to get the name, or the user data value.

Not the other way around!

wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
 

DataRow[] rows = yourTable.Select(string.Format("ID='{0}'",cbIDs.Text));

yourLabel.Text = (string)rows[0]["Name"];

JerryShaw
Posting Pro in Training
465 posts since Nov 2006
Reputation Points: 69
Solved Threads: 75
 

Thanks guys! That should help me.

functionalCode
Light Poster
32 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You