locked
Glitch with NotifyIcon with ContextMenuStrip RRS feed

  • Question

  • Hey all,

    I'm creating a program at the moment, and I'm having a problem with ContextMenuStrips (of all things!). I've associated it with a NotifyIcon, so that right-clicking the NotifyIcon shows the ContextMenuStrip. For some reason (unknown to myself), the ContextMenuStrip crashes sometimes (about 1 in 20 cases) - I'm on Vista and the ContextMenuStrip fades to white to show it's crashed, and the app also locks up (well, I have the app set up so that when I minimize its main window, it sets Form.ShowInTaskbar to false and the NotifyIcon.Visible to true, so it minimizes to the tray). Oddly enough, sometimes double-clicking to restore the main window (which I've set up through MouseDoubleClick of course) also fails - the main window shows as just a title bar, and also locks up the entire app.

    Any ideas on what could have caused this to happen?! The only thing I thought it could be was that I was manipulating the contents of the ContextMenuStrip in its Opening event - but after removing that even the problem still exists!

    - Javawag
    Monday, February 2, 2009 12:52 AM

Answers

  • Hi again,

    Sorry for not updating you on this. Eventually, the error did return - so recoding the menu from scratch and disabling the BalloonTip didn't work. What does seem to have worked is changing the behaviour of the form such that the ShowInTaskbar variable isn't changed - it's now always set to false.

    Hope this helps people,
    - Javawag
    • Marked as answer by Harry Zhu Friday, February 6, 2009 3:57 AM
    Thursday, February 5, 2009 3:42 AM

All replies

  • First of all, sorry for my bad English, I'm trying to improve it...

    * Delete all old ContextMenuStrip and create new one...   might solve that problem...

    * For be sure, Try it on xp os. with a virtual pc... then you can understand, it's a code error or os error( maybe it's a ram problem or cpu, I don't know )

    Or send part of ContextMenuStrip properties and codes to us, then maybe we can help you...

    Best Regards,
    -Macir
    Monday, February 2, 2009 1:18 AM
  • Thanks for your suggestions!

    OK, I deleted the NotifyIcon and ContextMenuStrip and rebuilt them from scratch - still the same. I don't have access to an XP virtual machine so I couldn't try that - however I did try changing the solution so that it runs in 32-bit mode (I have a 64-bit PC) - same problem though.

    Could it be anything to do with me using both a ContextMenuStrip with the NotifyIcon and a BalloonTip? (they do sometimes show at the same time, perhaps this "confuses" it?) Update: I've just tried removing the BalloonTip and it SEEMS to be working now... however I'll keep testing it tomorrow and if the error doesn't appear again I'll close the thread. Any idea why having a ContextMenuStrip and BalloonTip would cause that kind of behaviour?

    Many thanks,
    - Javawag
    Monday, February 2, 2009 3:36 AM
  • Hi,

    After you changed your code, does the error appear again?

    Could you please post your code ,so that other forum members having the same issue can fix it?

    Best regards,
    Harry
    Thursday, February 5, 2009 2:50 AM
  • Hi again,

    Sorry for not updating you on this. Eventually, the error did return - so recoding the menu from scratch and disabling the BalloonTip didn't work. What does seem to have worked is changing the behaviour of the form such that the ShowInTaskbar variable isn't changed - it's now always set to false.

    Hope this helps people,
    - Javawag
    • Marked as answer by Harry Zhu Friday, February 6, 2009 3:57 AM
    Thursday, February 5, 2009 3:42 AM