As per Cody's answer to this question, I derived a class from ContextMenuStrip and handle the ProcessCmdKey. This successfully prevents the menu from closing when pressing Enter while a textbox embedded inside the menu has focus. So all is well except for one thing.
Upon the Enter press, I remove the Textbox from the menu, and disposing this control causes the menu to close. When I do this:
If (m_inputPanel IsNot Nothing) Then m_inputPanel.Hide()
If (m_inputPanel IsNot Nothing) Then m_inputPanel.Parent.Controls.Remove(m_inputPanel)
If (m_inputPanel IsNot Nothing) Then m_inputPanel.Dispose()
the menu is closed. When I comment out the third line, the menu remains open. (Incidentally, m_inputPanel.Parent is a custom control which is embedded inside the menu using a ToolStripControlHost)
Why on God's Green Earth does it matter that I dispose a control which is no longer part of the menu?