Jump to content
Xtreme .Net Talk

I just broke the " Windows Form Designer generated code"...


Recommended Posts

Posted

...But I still have the interface design that took me forever to create. Is there a way to create a new solution and use an existing interface design without having to start from scratch on the design? Or is there a way to "fix" the code that I broke?

 

Any help would be appreciated.

 

-Greg

Posted

not too sure about this, but maybe copying and pasting the controls on a new form might get back the code? what you want to get back are the codes for the controls right?

 

- ashrobo

Posted

I'm not sure how messed up it is. I think I deleted one-too-many lines. Here is the part of the code that I modified.

 

#Region " Windows Form Designer generated code"

   'Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

Posted

Ok, I pasted in this portion of code:

 

#Region " Windows Form Designer generated code "

   Public Sub New()
       MyBase.New()

       'This call is required by the Windows Form Designer.
       InitializeComponent()

       'Add any initialization after the InitializeComponent() call

   End Sub

   'Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
       If disposing Then
           If Not (components Is Nothing) Then
               components.Dispose()
           End If
       End If
       MyBase.Dispose(disposing)
   End Sub

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.IContainer

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.  
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       components = New System.ComponentModel.Container()
       Me.Text = "Form1"
   End Sub

#End Region

 

It says that "InitializeComponect" has multiple definitions. These line of code seem to be the only difference but when I click start it loads a blank interface instead of the one with all my controls. The code for the controls is still there though??!!

Posted

The part I meant was just:

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

 

Oh, and to paste code that is color coded for VB i think you use vb in brackets.

C#
Posted

Thanks for the posting tip. It's still erroring out. I pasted in the code from a new solution. Any ideas what I might be doing wrong? I'm a newbie so let me know if I'm in the wrong forum.

 

The entire message in the pop-up tip is:

 

Method 'InitializeComponent' has multiple definitions with identical signatures

 

Thanks in advance

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...