如何在DataGridview中绑定ComboBox使用Windows应用程序 [英] How to Bind ComboBox in DataGridview Using windows application

查看:44
本文介绍了如何在DataGridview中绑定ComboBox使用Windows应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Windows应用程序的新手。在我的Datagridview中,我有3个comboBox国家,州,城市。根据国家,国家需要加载,根据州城市需要加载。给出样例。



感谢前进

I am new in windows application. In my Datagridview i have 3 comboBox Country,State,City. Based on Country, State need to load, Based on State City Need to Load.Give Sample Example.

Thanks For Advance

推荐答案

你好..



试试这些链接



http://msdn.microsoft.com/en-us/library/x8ybe6s2%28v = vs.80%29.aspx [ ^ ]



http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/32815eab-4f3b-44cc-aafc-64839481871b [ ^ ]



http://stackoverflow.com/questions/4293713/bind-combobox-to-datagridview-column [ ^ ]
hi there..

just try these links

http://msdn.microsoft.com/en-us/library/x8ybe6s2%28v=vs.80%29.aspx[^]

http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/32815eab-4f3b-44cc-aafc-64839481871b[^]

http://stackoverflow.com/questions/4293713/bind-combobox-to-datagridview-column[^]


有看一下DataGridViewComboBoxColumn [ ^ ]。级联下拉菜单可以帮助您创建一个选择,您可以选择国家,州和城市。
Have a look at the DataGridViewComboBoxColumn class[^]. Cascading dropdowns might help you create a selection where you can choose country, state and city.


var newColumn = new DataGridViewComboBoxColumn() {
    Name = "abc"
};
newColumn.DataSource = new string[] { "a", "b", "c" }; 
dgv.Columns.Add(newColumn);





但是,现在我想修剪某些行的列表。我正在尝试按行设置每行列表:





However, now I would like to trim the list for certain rows. I''m trying to set the list per row like this:

foreach (DataGridViewRow row in dgv.Rows) {
    var cell = (DataGridViewComboBoxCell)(row.Cells["abc"]);
    cell.DataSource = new string[] { "a", "c" };
}


这篇关于如何在DataGridview中绑定ComboBox使用Windows应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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