将DataGridViewComboBoxColumn添加到DataGridView Windows Forms Vb.net中 [英] Add DataGridViewComboBoxColumn into DataGridView Windows Forms Vb.net

查看:57
本文介绍了将DataGridViewComboBoxColumn添加到DataGridView Windows Forms Vb.net中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经能够在我的vb.net windows窗体程序中将单个datagridview单元格更改为组合框。现在我希望找到一种方法将整个列更改为组合框。这是我的代码将单个datagridview单元格更改为组合框,相同的方法应该工作,但我还没弄明白如何。非常感谢您提供的任何帮助或建议。 :)



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

解决方案

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



 对于单元格作为 整数 =  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


这篇关于将DataGridViewComboBoxColumn添加到DataGridView Windows Forms Vb.net中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆