
private voID dgvHarDWare_EditingControlShowing(object sender,DataGrIDVIEwEditingControlShowingEventArgs e) { if (e.Control is ComboBox) { ((ComboBox)e.Control).SelectionChangeCommitted -= new EventHandler(cboDgvHarDWare_SelectionChanged); ((ComboBox)e.Control).SelectionChangeCommitted += new EventHandler(cboDgvHarDWare_SelectionChanged); } } private voID cboDgvHarDWare_SelectionChanged(object sender,EventArgs e) { // string result is the selected text of the combo Box // int row is the row index that the selected combo Box lives string result = ((ComboBox)sender).SelectedItem.ToString(); // int row = ???? } 简而言之,我需要能够确定事件被触发的行,以便根据ComboBox选择更改行中的其他单元格.第二个函数的结果返回正确的值,这是值得的.
如果不清楚或者您是否需要任何其他信息,请告诉我.
谢谢,
安德鲁
int row = dgvHarDWare.CurrentCell.RowIndex;总结
以上是内存溢出为你收集整理的c# – DataGridView ComboBox EditingControlShowing事件全部内容,希望文章能够帮你解决c# – DataGridView ComboBox EditingControlShowing事件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)