C# datagridview 中添加下拉框,并绑定selectedindexchanged事件
绑定下拉框数据元的链接地址:http://stackoverflow.com/questions/8711182/datagridivew-datagridviewcomboboxcolumn-select-value-member
i have datagridview which has one combobox column. i populate combobox column. when i select any text from combobox column then i need to get the value when i read the data in for loop. dgFilter is here datagridview
here this way i read data from combobox column
but the problem is i am not getting the combox value member rather i am getting display member. so how to extract value member from for loop. please guide me with code. thanks |
绑定selectindexchanged事件的链接地址:http://s.yanghao.org/program/viewdetail.php?i=263596
C# code
//在datagridview的Editing事件里面写privatevoid dataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { ComboBox cb = e.Control as ComboBox; if (cb !=null) { cb.SelectedIndexChanged +=new EventHandler(cb_SelectedIndexChanged); } } void cb_SelectedIndexChanged(object sender, EventArgs e) { //这里执行你需要的,这就是下拉事件}
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步