Search code examples
vb.netvisual-studioribbon-controlmdiparent

RibbonPanel.Visible = False crashes form


I have a MDI (IsMdiContainer = True) Visual Basic .NET form in Visual Studio 2013 which is based on a System.Windows.Forms.Ribbon. It contains several RibbonTabs with RibbonPanels and RibbonButtons in them. If I make one of those panels (containing two buttons) not visible at design-time, I can not load the form at design-time anymore. The code the designer adds at the *.Designer.vb file is:

Me.pnl_accions_llistats.Visible = False

Which produces this error message:

Exception of type 'System.ComponentModel.Design.ExceptionCollection' was thrown.

Any idea on how to solve that besides removing the offending panel and their buttons? Found that using the offending line at *.vb in the Load event, works fine but I'm worried about the designer crashing that way.

I tried the solution suggested here but Visual Studio didn't show me any error when opening the form at design-time. However, using source control, I could easily identify the designer line of code that crashes the form.


Solution

  • The only solution I found was using the offending line in the Load event at *.vb.