Question

The first time that my ContextMenuStrip.Opening event is fired on my form, e.cancel is already True. Why is it doing this? I would expect e.cancel to be False, the way it is the other times it is fired. This is causing problems when the ContextMenuStrip doesn't appear when I want it to.

Was it helpful?

Solution

I found my problem: I'm populating the ContextMenuStrip within the Opening event, so the first time it is called it is empty and optimizes to e.Cancel = True. I just stick "e.cancel = False" in there and I'm good.

http://msdn.microsoft.com/en-us/library/ms229721.aspx

(spent the whole day searching, then find the answer as soon as I post the question...)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top