daniel11
daniel11

Reputation: 2041

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

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

Upvotes: 3

Views: 16090

Answers (4)

Ntando Sibanda
Ntando Sibanda

Reputation: 1

Hie

the easiest way to go about it is to copy the form files from you project folder and paste them in another folder e.g your desktop, and then delete the form from solution explorer and then go to the menu project/add existing item, and the add the copy you placed on the desktop to your project, it worked for me, try it.

Upvotes: 0

jefferp
jefferp

Reputation: 31

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.

Upvotes: 1

Scott Rippey
Scott Rippey

Reputation: 15810

While I don't know the exact cause of your issue, you should definitely take a look at the ".designer.vb" file. It's designer generated file, but it's not too hard to modify. And if there are compile errors, it will be easy to spot them!

Upvotes: 0

Mark Hall
Mark Hall

Reputation: 54532

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.

Upvotes: 9

Related Questions