且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将DataGridViewComboBoxColumn添加到DataGridView Windows Forms Vb.net中

更新时间:2023-12-06 16:49:46

这样的事情会对你有用吗?



 对于单元格作为 整数 =  1    n 
Dim myComboBoxCell 作为 DataGridViewComboBoxCell
DataGridView1( 3 ,n)= myComboBoxCell ' 根据需要进行更改
下一页单元格


I've been able to change an individual datagridview cell to a combobox in my vb.net windows forms program. Now I'm hoping to find a way to change the entire column to a combobox. Here is my code to change the individual datagridview cells to combobox, the same approach should work but I haven't figured out how. I greatly appreciate any help or advice you may offer. :)

Dim myComboBoxCell As New DataGridViewComboBoxCell
       myComboBoxCell.Items.Add("A")
       myComboBoxCell.Items.Add("B")
       myComboBoxCell.Items.Add("C")
       DataGridView1(3, 0) = myComboBoxCell

Would something like this work for you?

For cell As Integer = 1 to n
	Dim myComboBoxCell As New DataGridViewComboBoxCell
	DataGridView1(3, n) = myComboBoxCell    'Change as needed
Next cell