By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,454 Members | 3,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,454 IT Pros & Developers. It's quick & easy.

Help - Form1.vb design form is blank after VS.NET crash

P: n/a
I was dragging a third party component from the toolbar to drop on
form1, when for some reason Visual Studio gave me an unrecoverable
error and told me to save my work and restart VS. After restarting VS
I reloaded my project and was greeted by "Maximum Number of Errors
has been encountered." The second thing I noticed is that form1.vb
[design] form was now blank. No textblocks, comboboxes,
datagrids...everything I created is now gone. However all the form1.vb
code I wrote is still there. So all of the errors I have are because
all the textboxes etc no longer exist in form1. But if I run the
compiler and ignore the errors, my program executes just fine - has
all the textboxes, datagrids, etc.

Anyone know of a way I can fix the form design view without redrawing
the form?
-my other projects are fine
-tried running in another profile - no diff
-copied project to diff directory - no diff

Thanks a lot,

J

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Here is a longshot answer. I had a similar problem once where, all of
a sudden, all the controls of the form were gone. Turned out to be
that my app.config file had been corrupted. When I corrected it, it
solved the problem.

Another thing to try would be to create a new project and add all the
different files, etc from the current one, one at a time. Perhaps that
will help isolate the problem.

Nov 21 '05 #2

P: n/a
Chris,
Thanks for the reply. Luckily I was able to figure out what the
problem was. I wrote a little app to compare the windows generated
code from my corrupt form with windows generated code of a known good
form. What I found is that a little piece of code was missing:

"<System.Diagnostics.DebuggerStepThrough()> Private Sub _
InitializeComponent()"

Minus the quotes and all on one line of course. Depending on the number
of imports statements it should be around line 135.

Here's where it goes in case it ever happens to anyone else
(Watch out for _
the _
Underscore _
s):

#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.
Friend WithEvents Mas200 As System.Data.Odbc.OdbcConnection
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
Friend WithEvents OdbcDataAdapter2 As _
System.Data.Odbc.OdbcDataAdapter
Friend WithEvents etc
Friend WithEvents etc
Friend WithEvents etc
<System.Diagnostics.DebuggerStepThrough()> Private Sub _
InitializeComponent()
Dim resources As System.Resources.ResourceManager = _
New System.Resources.ResourceManager(GetType(Form1))
Me.Mas200 = New System.Data.Odbc.OdbcConnection
Me.TabControl1 = New System.Windows.Forms.TabControl
Me.TabPage1 = New System.Windows.Forms.TabPage
Me.TabControl2 = New System.Windows.Forms.TabControl
Me. etc
Me. etc

What a relief. I always backup at the end of the day...and as Murphy
would have it this was the end of the day right before I backed up.

J

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.