ColumnType = DataGridViewComboBoxColumn

peoman

Member
Joined
Oct 17, 2008
Messages
5
Programming Experience
Beginner
How can i make the Column.Item(1) be a DataGridViewComboBoxColumn?

Dim filePath As String = (My.Application.Info.DirectoryPath & "\options.xml")
Dim channelDS As New DataSet()
channelDS.ReadXml(filePath)

Try

With DataGridView1
.DataSource = channelDS
.DataMember = "channel"
.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
.Columns.Item(2).Width = 30
.Columns.Item(2).ReadOnly = True
.Columns.Item(0).HeaderText = "A2"
.Columns.Item(1).HeaderText = "A3"
.Columns.Item(2).HeaderText = "A1"
.Columns.Item(0).DisplayIndex = 1
.Columns.Item(1).DisplayIndex = 2
.Columns.Item(2).DisplayIndex = 0
End With

Catch ex As Exception
MsgBox("A: " & ex.Message)
End Try
 
You can't change the type of an existing column to DataGridViewComboBoxColumn any more than you can change the type of an existing Form to Button. If you want a DataGridViewComboBoxColumn then you need to create one yourself and add it to the grid, either in code or in the designer.

[ame=http://www.vbforums.com/showthread.php?t=541476]Adding a ComboBox Column to a DataGridView[/ame]
 
Back
Top