Home Forums WinForms controls Xceed Grid for WinForms edit ComboBoxEditor Reply To: edit ComboBoxEditor

Xceed Support
Member
Post count: 5658

Yes, it’s possible. Here, I did not handle all the possibilities (double values, validation, …). However, it should get you started.

<code>
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
For j As Integer = 0 To 3
Dim col As Column = New Column(“Column” & j.ToString())
gridControl1.Columns.Add(col)
Next j

wcb = New WinComboBox(EnhancedBorderStyle.None)

For i As Integer = 0 To 19
Dim row As Xceed.Grid.DataRow = gridControl1.DataRows.AddNew()
For Each cell As Cell In row.Cells
cell.Value = “Item ” & i.ToString()
Next cell
wcb.Items.Add(“Item ” & i.ToString())
row.EndEdit()
Next i

gridControl1.Columns(0).CellEditorManager = New ComboBoxEditor(wcb)
AddHandler gridControl1.Columns(0).CellEditorManager.DeactivatingControl, AddressOf CellEditorManager_DeactivatingControl
End Sub

Private wcb As WinComboBox

Private Sub CellEditorManager_DeactivatingControl(ByVal sender As Object, ByVal e As CellEditorEventArgs)
wcb.Items.Add((CType(e.Control, WinComboBox)).TextBoxArea.Text)
End Sub
</code>

Imported from legacy forums. Posted by CharlesB (had 266 views)