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

Lan Solo

Newcomer
Joined
May 28, 2003
Messages
15
Location
Alameda, CA
...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
 
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
 
Yes you can fix it but how bad is it messed up? Can you post the part of code you think you messed up?
 
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.

Code:
#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
 
If that is all you messed up, you can just create a new solution and copy and paste over it. It's always the same. At least, as far as I've seen.
 
Ok, I pasted in this portion of code:

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??!!
 
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.
 
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
 
InitializeComponent must be defined twice, it isn't within the pasted code but do a search for it and you should found a duplicate definition.
 
Back
Top