How to set the textbox as AutoSuggest in WinForms GridControl?
AutoSuggest textbox
There is no direct support for AutoSuggest in the TextBox cell. The ComboBox cell only contains AutoSuggest support. Therefore, to make a textbox cell an AutoSuggest textbox, modify the ComboBox cell to work like a TextBox cell.
Solution
You can change the appearance of a combo box cell like a text box cell by disabling the dropdown button using the ShowButtons property. You can achieve an AutoSuggest textbox by setting the AutoCompleteInEditMode property. By default, the suggested items can be dropped down while pressing the dropdown button of the ComboBox. Hence, you can display the dropdown items while entering the text by handling the CurrentCellKeyPress event.
In the provided sample, the 2nd row 1st column is set as an AutoSuggest textbox.
this.grid.CoveredRanges.Add(GridRangeInfo.Cells(1, 1, 1, 1));
this.grid[1, 1].CellValue = "AutoSuggest TextBox";
this.grid[1, 1].Font.Bold=true;
//Setting Combobox Celltype
this.grid[2, 1].CellType = GridCellTypeName.ComboBox;
//Hidding the DropDown button to show it as TextBox cell
this.grid[2, 1].ShowButtons = GridShowButtons.Hide;
//To make cell as AutoSuggest
this.grid[2, 1].AutoCompleteInEditMode = GridComboSelectionOptions.AutoSuggest; this.grid[2, 1].ChoiceList = choice;
this.grid.CurrentCellKeyPress += new KeyPressEventHandler(grid_CurrentCellKeyPress);
void grid_CurrentCellKeyPress(object sender, KeyPressEventArgs e)
{
if (this.grid.CurrentCell.Renderer is GridComboBoxCellRenderer)
this.grid.CurrentCell.ShowDropDown();
}Me.gridControl1.CoveredRanges.Add(GridRangeInfo.Cells(1,1,1,3))
Me.gridControl1(1, 1).CellValue = "AutoSuggest TextBox(2,1)"
Me.gridControl1(1, 1).Font.Bold = True
'Setting Combobox Celltype
Me.gridControl1(2, 1).CellType = GridCellTypeName.ComboBox
'Hiding the DropDown button to show it as TextBox cell
Me.gridControl1(2, 1).ShowButtons = GridShowButtons.Hide
'To make the cell as AutoSuggest
Me.gridControl1(2, 1).AutoCompleteInEditMode = GridComboSelectionOptions.AutoSuggest
Me.gridControl1(2, 1).ChoiceList = choice
AddHandler gridControl1.CurrentCellKeyPress, AddressOf gridControl1_CurrentCellKeyPress
End Sub
Private Sub gridControl1_CurrentCellKeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
If TypeOf Me.gridControl1.CurrentCell.Renderer Is GridComboBoxCellRenderer Then
Me.gridControl1.CurrentCell.ShowDropDown()
End If
End SubThe following
screenshot illustrates the output.

Figure 1: AutoSuggest TextBox