选择值多列组合框c#dektop应用程序
我正在创建一个桌面应用程序。 我的表单上有多列combobox控件,当用户单击datagrid时,它会弹出一个包含四列的窗口。 我想要的是,当用户选择datagrid的任意一行时,我得到该行任意一列的值。 是他们的任何方式。您添加了句柄事件 }选择值多列组合框c#dektop应用程序,c#,C#,我正在创建一个桌面应用程序。 我的表单上有多列combobox控件,当用户单击datagrid时,它会弹出一个包含四列的窗口。 我想要的是,当用户选择datagrid的任意一行时,我得到该行任意一列的值。 是他们的任何方式。您添加了句柄事件 } // Create an instance of the 'CurrentCellChanged' EventHandler. private void CallCurrentCellChanged() { myDataGrid.CurrentCe
// Create an instance of the 'CurrentCellChanged' EventHandler.
private void CallCurrentCellChanged()
{
myDataGrid.CurrentCellChanged += new EventHandler(Grid_CurCellChange);
}
// Raise the event when focus on DataGrid cell changes.
private void Grid_CurCellChange(object sender, EventArgs e)
{
// String variable used to show message.
string myString = "CurrentCellChanged event raised, cell focus is at ";
// Get the co-ordinates of the focussed cell.
var value= myDataGrid[myDataGrid.CurrentCell.ColumnNumber,myDataGrid.CurrentCell.RowNumber].Value