VB.net designer error.. how do I resolve it?

14,814

Solution 1

I am assuming you are programming in Windows forms. Goto to your Solution Explorer, Select your project and click on the show all files icon at the top of the Solution Explorer. You should then be able to expand out your frmMain.vb to see all the sub files. Look for a frmMain.Designer.vb and check it for a duplicate resource entry. If that doesn't work try cleaning your Solution. What happened is the designer had an error and once you lost the form you still had the Designer file which has the InitializeComponent method which creates and initializes all of your control, you really are not supposed to edit this file because it automatically modified when you add controls. In your case you may be able to remove the declarations from your file and then add the components in your designer which should recreate the information in your designer.vb file.

Solution 2

Here's another way it can get messed up, and solved. I had a partial class for one of my forms. If I double clicked on it, Visual Studio would create a blank form, and put in an initializer. The initializer would receive the same name as my main form. That caused the error. I resolved it by putting all of the code in the main form, rather than in a partial class of the same name. Major bug, but at least it can be worked around.

Share:
14,814
daniel11
Author by

daniel11

Updated on June 05, 2022

Comments

  • daniel11
    daniel11 almost 2 years

    I got an error when I tried to open the designer for one of my forms in Visual Basic 2010 express and I had the option to ignore it so I clicked that (which I regret doing so much) and now my form is erased, but I still have the code for it. I tried right clicking and selecting show designer but it just brings up a blank form. I had a datagrid control called "DataGrid1" and when i tried adding a new control to the blank form it says that "DataGrid1" already exists but it doesn't. So after I resolved the first 85 errors I got one more that doesn't make sense:

    Error 1 The item "obj\x86\Debug\WindowsApplication1.frmMain.resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter. Example 1

    If anyone knows what this means and how to fix it I would appreciate it so much because losing this application isn't an option for me right now.

    OS: Windows 7 x64 Software: Visual Basic 2010 Express Language: VB.net