المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Setting Datagridview combobox column value to null.



C# Programming
06-12-2010, 10:21 PM
There's an editable datagridview populated from a table say tblItems. Among the columns of the datagridview there's a combobox column named 'Category'. This column is populated by the respective 'Category' column of tblItems. Now in the 'Category' column of the datagridview I want to set the value of a certain cell to Null programmatically. Suppose when I press keyboard Delete button over the cell or some other button on the form, the value of the cell becomes Null. Datagridview.keydown event isn't working as when the cell is selected the focus is actually on the editingcontrol of the cell and not the datagridview. Also the combobox editingcontrol doesn't have any 'SelectedIndex' property that can be set to -1. Any idea plz? Regards.