Set DropDownStyle of a DataGridViewComboBoxColumn on startup?
<p>I have a DataGridView with three DataGridViewComboBoxColumns. By default, their DropDownStyle is DropDownList, but I want it to be DropDown. I can change the type to DropDown in the DataGridView's EditingControlShowing method, but that is after the program is launched and a ComboBox is selected. I already have code in the DataGridView's CellValidating method to allow me to add new values to these ComboBoxColumns, but I can't edit the ComboBox without double-clicking on it. Here's some code that currently throws an InvalidCastException.</p>

<pre><code>Dim column As New DataGridViewComboBoxColumn()
        column.Name = "Name"
        column.HeaderText = "Name"
        column.DisplayMember = "Name"
        column.ValueMember = "Name"
        column.DataSource = DataTable
        DataGridView1.Columns.Insert(15, column)
        For i = 0 To column.Items.Count - 1
            Dim cb As ComboBox = CType(column.Items(i), ComboBox)
            If (cb IsNot Nothing) Then
                cb.DropDownStyle = ComboBoxStyle.DropDown
            End If
        Next
</code></pre>