2012-03-24 3 views
0

Я создаю настольное приложение. У меня есть элемент управления combobox MultiColumn в моей форме, на котором при щелчке пользователем datagrid появляется всплывающее окно, содержащее четыре столбца. что я хочу, когда пользователь выбирает любую строку datagrid, я получаю значение любого столбца выбранной строки. Это их способ.selected value multicolumn combobox C# dektop application

ответ

0

Вы добавляете обрабатывать 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 

}