Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a data entry form that had several comboboxes on it. Each of the combo boxes has its own binding source and it is populating correctly when I launch the form. However, if I edit the record on the form and try to pass to the database the updated selectedvalue from the combobox I get an error that the value I am passing it NULL.

This issue seems to happen every other time I run the darn thing and I can't figure out why it is not working properly. Basically I am trying to insert a new record into a table but for some reason it is failing to pull my selected value. My code to insert the data is below:

Data.Manager.AddEmployee
 (
   InactiveEmployeeSelected.GUID,
   Convert.ToByte(RoleComboBox.SelectedValue),
   NotesTextBox.Text.Trim(),
   ScheduleTextBox.Text.Trim(),
   ExtensionTextBox.Text.Trim(),
   CodeTextBox.Text.Trim(),
   Convert.ToBoolean(EBApprovedCheckbox.CheckState),
   Convert.ToByte(ApprovalLevelComboBox.SelectedValue),        //pulling null
   Convert.ToBoolean(AssignComtracksCheckbox.CheckState),
   Security.Manager.CurrentUser.GUID,
   DateTime.Today,
   Convert.ToBoolean(IsActiveCheckbox.CheckState)
);

Any help would be greatly appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
554 views
Welcome To Ask or Share your Answers For Others

1 Answer

Maybe, you just need to use the SelectedItem, instead!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...