RibbonPanel.Visible = False crashes form - vb.net

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.

Related

Cannot set a default item in combobox in certain project

In my VB.NET solution in Visual Studio 2015 I have some projects which contains some Windows Forms items. In general I know how to programmatically set a default item in a combobox control by using ComboBox1.SelectedIndex = 0 instruction. However this instruction do not work in one of my projects and my combobox is always blank when program runs. I also cannot add programmatically new items to combobox in this project, I can do it only using Properties sidebar.
My program runs normally, Visual Studio do not see any errors, instructions which concerns my combobox are executed but don't affect it. In other projects everything works well.
Have you ever encountered something like this? Maybe I've unconsciously changed some options in this project and that's why the problem occur?
EDIT:
Problem solved. I didn't noticed that during copying some code I accidently also copied InitializeComponent() instruction. Without this duplicated initialize instruction everything is working well and I have ability to manage default value of my combobox correctly.

How to find a form from many forms in vb6 on a existing project

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.

possible data loss in designer of a vb.net form

I opened Visual Studio 2013 and loaded my project but I got this error
The designer cannot process the code at line 28: Me.AgentDB_DataSet = New appli.agentDB_DataSet() The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.
Here is a picture of the error:
I made a copy from the application, and clicked on ignore and continue ... then it loaded my form empty all controls were lost
please help me I'm scared of loosing all the work.
This is the list of errors I get when I try to compile:

Deleting menu item results index error ("source not found")

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!

Clean up Designer.vb file in Visual Studio 2008

I noticed that my Designer.vb file of one of my forms has a lot of controls that aren't even used or visible on my form. This is probably from copying controls from my other forms. Is there a way to clean up the Designer.vb file and get rid of all the unused controls?
**UPDATE: This is for a Windows Form project.
The only real solution I see is to copy all the controls into a new form by selecting them in the designer. This way all the not created controls should not follow you to the next form.