Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Tracking DataGridViewComboBoxColumn doublick event
 

Tracking DataGridViewComboBoxColumn doublick event

Hi All,

Does any body know how to track the double click event of a ComboBoxThat I got byaddingDataGridViewComboBoxColumn in a DataGridView.

Please help I need the solution as soon as possible.

Thanks,

Somen

somen  Thursday, March 13, 2008 3:25 PM

Hi somen,

You can handle the DataGridView.EditControlShowing event where you cast the control into a DataGridViewComboBoxEditingControl and hook up its MouseDoubleClick event handler.

Code Snippet

void Form1_Load(object sender, EventArgs e)

{

dataGridView1.EditingControlShowing += new

DataGridViewEditingControlShowingEventHandler(dataGridView1_EditingControlShowing);

}

void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)

{

if (dataGridView1.CurrentCell.ColumnIndex == 1)

{

DataGridViewComboBoxEditingControl cell = e.Control as DataGridViewComboBoxEditingControl;

cell.MouseDoubleClick += new MouseEventHandler(cell_MouseDoubleClick);

}

}

Best regards,

Jacob

Jacob Sui - MSFT  Monday, March 17, 2008 6:24 AM

Hi somen,

You can handle the DataGridView.EditControlShowing event where you cast the control into a DataGridViewComboBoxEditingControl and hook up its MouseDoubleClick event handler.

Code Snippet

void Form1_Load(object sender, EventArgs e)

{

dataGridView1.EditingControlShowing += new

DataGridViewEditingControlShowingEventHandler(dataGridView1_EditingControlShowing);

}

void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)

{

if (dataGridView1.CurrentCell.ColumnIndex == 1)

{

DataGridViewComboBoxEditingControl cell = e.Control as DataGridViewComboBoxEditingControl;

cell.MouseDoubleClick += new MouseEventHandler(cell_MouseDoubleClick);

}

}

Best regards,

Jacob

Jacob Sui - MSFT  Monday, March 17, 2008 6:24 AM

You can use google to search for other answers

Custom Search

More Threads

• ReportViewer, chart, SQL ---which subject should I put under?
• DataGridView Custom BackGround
• DataAdapter.Update not working
• How do you unbind your datagridview so you can use datagridview.columncount = 0;
• Keypress
• DataGridViewCheckBoxCell not using Style?
• Does it MVP or no?
• Another Help needed with TableAdapters, RowUpdated, Access db, VB2008
• How to select an item from the combobox column dropdown list
• Adding New Row to DataGridView: What Keys to Press?