> I am having problems with a combobox that I have for a grid. When I clear the text for that cell which has the combobox, the value is treated as 'illegal' since an empty string is not one of the items on the list. I want to keep AutoComplete and make the choices exclusive to the list but I also need to clear the selected item. When the selected text is cleared it has the effect of making the entry invalid, thus disabling entry in the grid until the invalid string is resolved. Is there a easy way to clear this value like in a combox box you would set the selectedindex to -1.
>
> thanks!
>
> tim
>
With 1.6.1, if the cell does not have focus, you can just use an indexer to set it blank and this will blank out the cell.
this.gridControl1[5,3].Text = "";
If you want to blank it out typeing, here is a try at it handling the CurrentCellValidating event.
private void gridControl1_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
if(cc.Renderer is GridComboBoxCellRenderer && cc.Renderer.ControlText == "")
{
cc.CancelEdit();
this.gridControl1[cc.RowIndex, cc.ColIndex].Text = "";
}
}