Avatar of ict-torquilclark
ict-torquilclark

asked on 

why is this code adding two columns?

I am using the attatched code to add a comboboxColumn to a datagridview

can anybody suggest why it might be adding the column twice?
'Adds Inactive Reason Conbobox's 
        sqlStr = "SELECT * FROM Inactive"
        rs.Open(sqlStr, sqlCnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
        Dim dgvCol As New DataGridViewComboBoxColumn
        Do While x < rs.RecordCount
            dgvCol.Items.Add(rs.Fields("Description").Value)
            x = x + 1
            rs.MoveNext()
        Loop
        rs.Close()
        datagridviewMembers.Columns.Add(dgvCol)

Open in new window

Visual Basic.NET

Avatar of undefined
Last Comment
Nasir Razzaq

8/22/2022 - Mon