0
我正在創建一個桌面應用程序。 我的窗體上有MultiColumn組合框控件,當用戶點擊一個數據網格時,它就是一個包含四列的彈出窗口。 我想要什麼,當用戶選擇任何一行datagrid時,我得到該選定行的任何一列的值。 是他們的任何方式。選定值multicolumn combobox c#dektop應用程序
我正在創建一個桌面應用程序。 我的窗體上有MultiColumn組合框控件,當用戶點擊一個數據網格時,它就是一個包含四列的彈出窗口。 我想要什麼,當用戶選擇任何一行datagrid時,我得到該選定行的任何一列的值。 是他們的任何方式。選定值multicolumn combobox c#dektop應用程序
你加處理DataGrid.CurrentCellChanged事件
// 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
}