I have a DataSet, where in the first table and in the row i got a column called OrderStatus.
This field is a number between 0 and 3. What I want to achieve is when the data is loaded, I want to see the clear text of theOrderStatusin theComboBox` on my windows form.
Status 0 = Order in progress, 1 = Order is packaged, 2 = order
complete etc.
I have not found a way of binding the combobox and use a list of values to display the status in clear text.
Also when iIchange the status with the combo box I want it to reflect back to the dataset.
Use the
DisplayMember and ValueMember propertyof the combo box.The DisplayMember of a Combobox gets or sets a string that specifies the property of the data source whose contents you want to display. Here you want
Order In Progress,Order is packagedetc..The ValueMember property determines which value gets moved into the SelectedValue of the Combo Box. here you will set the corresponding ID values i.e. 0, 1, or 2 in your case
So,
OnSelectionChangedyou can get the SelectedValue i.e. 0, 1 or 2 which you bind earlier and update back the DataSet.