المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Get the underlying combo of a datagridviewcomboboxcolumn



C# Programming
08-22-2009, 12:24 AM
Hello

I'm trying to acceed the combobox property of a datagridview combobox column

I can do it using the EditingControlShowing event

// ***********************************************************************************
private void DgvKeys_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (noEvent)
{
return;
}

ComboBox combo = e.Control as ComboBox;
}

But I need to acceed directly any combo in some column without having to waint an event on it !
To set the combo selected intex for example

I was trying this but it does not work !

DataGridViewComboBoxColumn cby;
cby = (DataGridViewComboBoxColumn)DgvKeys.Columns["Region"];
cby.SelectedIndex = cby.FindStringExact(combo.Text);


Any idea ?