Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combobox valuemember save

Status
Not open for further replies.

regulardude

Programmer
Oct 24, 2007
18
US
I have dynamically populated serveral comboboxes on the form load in this manner:
Code:
// Populate Rating ComboBox
            ds_Lookups.dt_RatingRow newRatingRow =
             ds_Lookups.dt_Rating.Newdt_RatingRow();
            newRatingRow.ID = "5";
            newRatingRow.Description = "Outstanding";
            ds_Lookups.dt_Rating.Rows.Add(newRatingRow);

            newRatingRow = ds_Lookups.dt_Rating.Newdt_RatingRow();
            newRatingRow.ID = "4";
            newRatingRow.Description = "Above Average";
            ds_Lookups.dt_Rating.Rows.Add(newRatingRow);

       propRatingComboBox.ValueMember = "ID";
            propRatingComboBox.DisplayMember = "Description";
            propRatingComboBox.DataSource = ds_Lookups.dt_Rating;

My problem is that when I export to XML, I am not getting the results I want.

Instead of getting the ID/ValueMember, I am getting the DisplayMember.

How do I get the ID/ValueMember to be exported to XML?

Thanks
 
Found the answer to my own question:


myComboBox.DataBindings.Add("SelectedValue", BindingSource_LienData, "NameofFieldinDataSource");
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top