FIX: All controls on a Windows Form disappear if you remove the reference to one control from the project in Visual Basic .NET 2002 (316171)
The information in this article applies to:
- Microsoft Visual Basic .NET (2002)
This article was previously published under Q316171 SYMPTOMS When you add several references to ActiveX controls in a Microsoft Windows Forms application
that you created by using Microsoft Visual Basic .NET, and then you remove one of the references from the project, all of the controls on the form
disappear.
RESOLUTION To recover the controls that you lost when you removed the
references, you must modify the Windows Form Designer-generated code as
follows:
- Open the Code window for Form1.
- Expand the "Windows Form Designer generated code"
region.
- Locate each of the following lines of code in the call to
the IntializeComponent method, and then comment out each line:
Friend WithEvents AxStatusBar1 As AxMSComctlLib.AxStatusBar
Me.AxStatusBar1 = New AxMSComctlLib.AxStatusBar()
CType(Me.AxStatusBar1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.AxStatusBar1.Dock = System.Windows.Forms.DockStyle.Bottom
Me.AxStatusBar1.Location = New System.Drawing.Point(0, 357)
Me.AxStatusBar1.Name = "AxStatusBar1"
Me.AxStatusBar1.OcxState = CType(resources.GetObject("AxStatusBar1.OcxState"),System.Windows.Forms.AxHost.State)
Me.AxStatusBar1.Size = New System.Drawing.Size(424, 25)
Me.AxStatusBar1.TabIndex = 1
CType(Me.AxStatusBar1,System.ComponentModel.ISupportInitialize).EndInit()
Note These lines of code do not appear sequentially in Microsoft Visual Studio
.NET. - Modify the following code in the InitalizeComponent method from
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.AxStatusBar1, Me.Button1})
to:
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Button1})
Note These steps are based on the sample from the "More Information"
section. Therefore, this sample code may differ from the code in your project,
depending on the controls that you use. STATUS
This bug was corrected in Microsoft Visual Basic .NET 2003.
Modification Type: | Minor | Last Reviewed: | 1/25/2006 |
---|
Keywords: | kbvs2005swept kbvs2005doesnotapply kbfix kbCtrl KB316171 |
---|
|