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.
The only solution I found was using the offending line in the Load event at *.vb.
I am working on a old project of vb6 which has hundreds if forms. I am able to run the application and have to fix a runtime error in a form which pop up. I don't know the name of the form and only have visual reference. I tried using debug but It has continues SQL statements running in a loop. Any advice is appreciated.
Thanks.
Search the code for the form caption, or the labels of controls on the form, using visual studio's "find in files" or simlar function of your favourite editor.
If the caption is set in the form design, this will take you to the .frm file the form is stored in. You can open this in Notepad or another editor to get the name of the class (which is usually the same as the filename).
If the caption is set in code, you can place a breakpoint on that line. Again, this will lead you to the code which instantiates the form.
I am new to vb.net 2015 but I am using vb6 for more than few years.
I am crating new form with three buttons and placed Toggle brakepoint at button1_click1(..) 1st line of code. On clicking button in debug mode, execution stopping at 1st line and on pressing F11 key cursor moving with yellow highlight to next line and so on.... But I am watching form nothing is getting changed in executed form unless I execute command refresh after every line (just to watch form changes) or completion of whole sub that is on moving out of end sub form getting refreshed.
But in vb6 on moving out of every line form was getting changed.
Can anyone please help me out how to get form automatically get refreshed on moving out from every line of code. Thanks
1) Before Refresh() code 2) After Refresh() Code 3) VB6 not like vb.net
While I know that does not resolve your problem... It is working as designed. Please look at the following link, it may give you some ideas
Blank Form When Debugging
In VB.Net 2010, whenever I delete a menu item on a Windows Form (a Mainmenu1 object), an exception is thrown at run-time suggesting that there is an index value missing -- essentially a "source not found" error. Do I need to go into the Mainmenu1 object on the bottom of the Form at design time and do something? (BTW, I have also tried deleting the source code for the menu item, and then the menu item, and the exception is still thrown).
Basically, something is occurring that is not allowing me to simply delete a menu item, and get a successful run thereafter.
I had this problem. The simple fix is to restore the menu by clicking undo. Then run the code to make sure it still works. When you have done this, CLOSE visual studio. Then open VS and load your project. Delete the item from the menu and run the project. Everything should be fine
I think you need to specify whether you were trying to delete the menu or menu item during run time, or during design time.
You said, an exception, indicating an index value was missing, thrown at run time. I think it might be depending on how you deleted the menu item. You didn't mention how you deleted the menu item.
Normally, when you choose a menu item from a menu at design time, and press the Delete key, it disappeared. And, the program still works fine.
And, another possibility, is that your form window designer and the background designer code is not properly synced.
You might know that, every .NET form objects, have their background designer code, which serves as a schema for everything on the form.
When you add a button onto the form, the Visual Studio add a line of code in the designer code file (normally if your form name is form1, the designer code file is form1.designer.vb or cs or whatever). When you change the background colour of the button, designer code file add a line of code to set the button's background colour.
So, you see, in your case, when you delete the menu item, your designer code file probably didn't successfully remove the code relating to that menu item. So, it throws an exception at run time.
Maybe, it's because of your Visual Studio installation.
So, my suggestion is, you should try debugging the project, line by line, by running the project with F6 or F11 (sorry, I don't remember the exact key, but you can find it in the Debug menu).
I hope I made a good sense for your problem!
I have a very small VS2008 Winforms project that will not start.
When I attempt to start debugging the project, I get the message:
'<form>' is a type in '<project>' and cannot be used in an expression.
From the file .Designer.vb.
The problem is that is indeed a form. If I create a new WinForm and set the startup object to the new form, I get the same message.
When I attempt to check the "Enable application framework" checkbox in the Project properties, I get the message "Startup object must be a form when 'Enable application framework' is checked.
I've tried creating a new project and moving all the code and designer objects to a new form file in the new project, and same result.
Other projects on the same computer run fine.
Any suggestions?
Thanks!
Turns out that the problem was that I didn't have a New() function with no parameters. This is required for VS to see the class as a form.