【问题标题】:How to populate datagridview combobox based on the value of other combobox using c#.net windows application如何使用 c#.net windows 应用程序根据其他组合框的值填充 datagridview 组合框
【发布时间】:2015-01-27 21:10:56
【问题描述】:

我有一个带有两个组合框列的 datagirdview。例如,国家和城市。如果我在 datagridview 中选择国家组合框,城市组合框列必须绑定,基于使用 c# .net windows 应用程序选择的县。

我无法获取所选国家/地区的值。我必须绑定城市组合框列。

提前致谢。

【问题讨论】:

    标签: c# datagridview combobox


    【解决方案1】:
    private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
                 if(e.ColumnIndex==0)// Country
                {
                    // Build the combox items for CITY
    
                }                           
        }
    

    我假设 ColumnIndex=0 作为国家。我们选择国家后,触发了 CellEndEdit 事件。在该事件中,我们可以根据我们选择的 Country 绑定 City 项目。希望此帮助有用...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多