Re: Controls disappear from designer...

From: Aaron Smith (thespirit-1-_at_smithcentral.net)
Date: 12/02/04


Date: Thu, 02 Dec 2004 21:16:30 GMT

Yep, Herfried, clued me in to look around and I found it.. Let me tell
ya, I was freaking out there for a minute!

Zorpiedoman wrote:
> Aaron -
>
> There are a number of reasons this will happen, so I can't tell you why it
> happened. Usually this happens because some code you wrote created an error
> condition that would not allow the form design to complete.
>
> I can tell you how to fix it without starting all over, however. In the
> code for the form, check the mysterious "Windows Form Designer generated
> code" region...
>
> It normally looks something like this:
>
> 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.
> Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
> InitializeComponent()
> Me.TextBox1 = New System.Windows.Forms.TextBox
> Me.SuspendLayout()
> '
> 'TextBox1
> '
> Me.TextBox1.Location = New System.Drawing.Point(0, 0)
> Me.TextBox1.Name = "TextBox1"
> Me.TextBox1.TabIndex = 0
> Me.TextBox1.Text = "TextBox1"
> '
> 'Form2
> '
> Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
> Me.ClientSize = New System.Drawing.Size(568, 421)
> Me.Controls.Add(Me.TextBox1)
> Me.Name = "Form2"
> Me.ResumeLayout(False)
>
> End Sub
>
> #End Region
>
> What usually is missing is the line(s) in the InitializeComponent section
> thats sets your control objects to new instances of the control:
>
> "Me.TextBox1 = New System.Windows.Forms.TextBox"
>
> OR the line(s) that add the control(s) to the form's control collection are
> missing:
>
> "Me.Controls.Add(Me.TextBox1)"
>
> Just figure out what is missing, and type it in, and you should be good to go!
>
> --Zorpie
>
> "Aaron Smith" wrote:
>
>
>>I have a problem... Have a form, made some changes.. now all the
>>controls are gone. I didn't make any changes to the designer generated
>>region.. I'm not really sure what happened to them, but this has
>>happened before where one or two will disappear.. They are still in the
>>code too.. And if I try to add a new control with the same name, it says
>>it exists... Any ideas?
>>--
>>---
>>Aaron Smith
>>Remove -1- to E-Mail me. Spam Sucks.
>>

-- 
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.


Relevant Pages

  • Re: Recognize change immediately
    ... If there are missing fields the record must not be ... Validate is a general sub, not attached to any control, form, etc. ... > procedure of the Tab Control. ...
    (microsoft.public.access.formscoding)
  • Re: Wheres the Control.Load event??
    ... get fired right after the control is added to the form or another control. ... Dim mstrDefaultValue As String ... Public Sub New ... 'Required by the Windows Form Designer ...
    (microsoft.public.dotnet.languages.vb.controls)
  • Re: System.ArithmeticException in VStudio 2003
    ... > blank form to a project, then I add a default control of ... > Public Sub New ... > InitializeComponent() call ... > 'Required by the Windows Form Designer ...
    (microsoft.public.dotnet.languages.vb)
  • Wheres the Control.Load event??
    ... there is no Load event for an inherited control. ... Dim mstrDefaultValue As String ... Public Sub New ... 'Required by the Windows Form Designer ...
    (microsoft.public.dotnet.languages.vb.controls)
  • System.ArithmeticException in VStudio 2003
    ... then I add a default control of ... Protected Overloads Overrides Sub Dispose(ByVal ... Windows Form Designer ... Sub InitializeComponent() ...
    (microsoft.public.dotnet.languages.vb)