Click here to Skip to main content
15,895,557 members

Response to: insert DataGridViewComboBoxColumn once in a DataGridView on form load

Revision 2
i have 7 columns so when the form is loaded for the first time, the number of columns become 8 because of the insertion of the cmb.
so i use this code to prevent further insertion of cmb
VB
If DataGridView.Columns.Count < 8 Then
                   Dim cmb As New DataGridViewComboBoxColumn()
                   cmb.HeaderText = "Promoted To"
                   cmb.Name = "cmb"
                   cmb.MaxDropDownItems = 4
                   DataGridView.Columns.Insert(4, cmb)
               End If
Posted 7-Oct-12 10:47am by wizy@2020.
Tags: