ComboboxColumn的用法网上很多,绑定数据源都很简单,这里我遇到的是、不绑定数据源,即所有comobox的绑定都是固定的几个数据:

                           ComboboxColumn取值——Winform中DataGridView中某一列使用下拉框

可以看到没有绑定任何数据源,

     ComboboxColumn取值——Winform中DataGridView中某一列使用下拉框

 ,在后台cs中取到下拉框的值,通过linq将所有的下拉框的值存入了List<string>中:

1 List<string> list = new List<string>();
2 list.AddRange(from DataGridViewRow row in DataGridView1.Rows select row.Cells["Comobox1"].EditedFormattedValue.ToString());

可以看到使用的是EditedFormattedValue属性,该属性能够取得comobox中所显示的值,不管其是否已经提交。

 

相关文章:

  • 2021-12-10
  • 2021-12-09
  • 2021-08-20
  • 2021-06-21
  • 2021-11-19
  • 2021-03-29
  • 2022-12-23
猜你喜欢
  • 2021-08-09
  • 2021-06-09
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-05-01
相关资源
相似解决方案