Groups | Blog | Home
all groups > visual studio .net general > september 2007 >

visual studio .net general : System Errors after copying new form.


Greg
9/22/2007 12:46:00 PM
I am using Visual Studio.Net - Visual Basic 2005

I got the following two errors after twice doing the following:

1. I copied an existing form named frmPrintLables and pasted it as
frmRejects.
2. I created a new form from scratch named frmRejects.

Error 1 [The item "obj\Debug\PFCWin_Touch_Screen.frmRejects.resources" was
specified more than once in the "Resources" parameter. Duplicate items are
not supported by the "Resources" parameter. PFCWin Touch Screen]
Error 2 ['Protected Overrides Sub Dispose(disposing As Boolean)' has
multiple definitions with identical signatures. C:\Documents and
Settings\Tom\My Documents\Visual Studio 2005\Projects\Touch Screen v2\PFCWin
Touch Screen\PFCWin Touch Screen\frmPrintLabels.Designer.vb 7 29 PFCWin Touch
Screen]

These errors appeared each time I did this. The first error highlighted the
"Dispose" method from the frmPrintLabels form. Also, error 2 highlighted the
Initialize Component line on the frmPrintLabels form. Neither the error
message nor the code highlighted provided an ounce of information in
understanding what fail.

I tried Building the applicaiton and no luck. I checked the name of the
formI copied and made sure it was correct and still no luck. Finally, I just
deleted the frmRejects form. Then, I had to Build the project to clear up one
of the errors. At this point, I concluded you cannot copy a form inside a
project even though the utility is provided.

Lastly, I created a new form named frmReject this time. Everything was fine.
So, I decided to delete frmReject and try adding frmRejects again. This time
it worked.

Anyways, why is this happening to begin with. And, if this happens what am I
supposed to do about it to fix it? I know this is impossible to do, but I
would like to know why I cannot copy an existing form to a new form or I need
to know what I must do to allow me to. According to what I have read, the
section of the code that was highlighted is something managed by Microsoft
and that I should not modify it. Of course, I wouldn't have a clue on how to
change it anyways.

Any help or insight to why this happens would be appreicated.

Greg


Stevanich
9/23/2007 2:52:53 AM
Greg,

You can copy the form, but then you need to open up the Code View, and
change the name of the form so it doesn't match the source form's name.

Hope this helps,


Steve - dotneticated.com

[quoted text, click to view]

jetan NO[at]SPAM online.microsoft.com (
9/24/2007 2:36:20 AM
Hi Greg,

Yes, Steve is correct. When you copy and paste a form in the VS2005
designer, the VS2005 will make a second copy of the original code file. So,
the pasted copy *.cs file and the original *.cs file have the same Form
class name(frmRejects). While you are compiling, the compiler and linker
will see two classes with the same name, so it will emit the error you are
seeing.

To resolve this problem, you may change the Form class name to another
one.(Note: since VS2005 designer uses partial class, you should also change
the class name in Form.designer.cs file)

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
AddThis Social Bookmark Button