By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,045 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Deselect text when right-click DGV cell

P: 116

I have implemented a right-click event on DGV cells. However if the text in the cell is being edited (ie, has a cursor or selected text) the right-click event doesn't fire and the standard context menu appears instead.

Is there a way to force the firing of the event rather than the context?

I've tried everything from ClearSelections(), EndEdit(), CurrentCell = Nothing etc on noting the right-click and nothing works.

Any ideas?

Mar 22 '14 #1
Share this Question
Share on Google+
1 Reply

P: 294
Did you think of Leave? You could put an
Expand|Select|Wrap|Line Numbers
  1. If Then
statement in your Right Click event that handles if that DGV cell has focus, and if so, then try to call your Leave or .CellLeave method. (Note: .CellLeave is for .NET 4.5 and later.)
Mar 25 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.