Trying to trap DataGridViewComboBoxCell is not valid error

Joined
Jun 14, 2010
Messages
5
Programming Experience
Beginner
I have some datagridviews on a form which have a combobox column in them. It works but if there is no record found in the combo then a DataGridViewComboBoxCell is not valid error is given whenever the cursor passes over that field. I'd like to get rid of that error message. The thing is my dgv and the combo on it are entirely generated by code. I have found some error-trapping code on a Microsoft site but it is designed for a dgv on a form not generated by code. I don't know how to adapt it or if that can even be done. Could I generate one of these error handling routines for each dgv in code? How would you do that? Or is there another way to deal with this error?
 
I have found some error-trapping code on a Microsoft site but it is designed for a dgv on a form not generated by code.
They are the same controls. The only difference is that, if you have no member variables that refer to the controls, you have to use the AddHandler statement to attach event handlers rather than a Handles clause. The event handlers themselves will be the same. If you need to refer to the control itself within the event handler then you use the 'sender' parameter.
 
Back
Top