Hi Malcolm,
> if you are currently typing text in the cell I just get a context menu like this:
In this case, the current cell is in edit mode. Right-clicking in the hosted editing control, i.e. a TextBox in this case, gets the built-in context menu of a TextBox to pop up.
You can replace the built-in context menu of a TextBox with your own contextmenustrip by setting the ContextMenuStrip property of the TextBox. In your scenario, you can handle the EditingControlShowing event of the DataGridView to get the hosted TextBox and then set its ContextMenuStrip property. For example:
void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
TextBox txtbox = e.Control as TextBox;
if(txtbox!=null)
txtbox.ContextMenuStrip = this.contextMenuStrip1;
}
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.