Hi Manoj,
I tried binding a similar ComboBox to a string field, and amended my Class to use string fields rather than one string and one byte fields.
I can confirm that whatever appears in the drop down box is what appears in the database.
The "UserLevels.Add(new UserLevel("8", 4));" code was simply to check what would happen!
So the problem seems to be that although the ComboBox sets the Value (as shown by
userLevelComboBox.SelectedValue.ToString()) to "4" rather than "8", it is 8 that ends up in the database.
I have found away around this...
In the xxx.Designer.cs file the following binding appeared:
this.fullNameComboBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.usersBindingSource, "FullName", true));
I manually changed this to:
this.fullNameComboBox.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.usersBindingSource, "FullName", true)); // Manually changed "Text" to "Value"
This has done the trick, but I don't as a rule make any changes in the ...Designer.cs files. Is this the right way of going about things?