Form Wizard not working

G

Guest

Hi Everyone,
I'm hoping someone out there can give me some guidance. I'm currenlty using
VS2005 and the other day the Form Wizzard stopped working. What I mean, is
that the wizzard no longer creates the code in the "Windows Form Designer
generated code" section. As a matter a fact, if I add a new form to the
project, that section is not even there. The only code that you will see is:
Public Class Form2

End Class

As you can see, it just creates an empty class. If I add controls to the
form, it seems like things are working, but I can check the code again, and
no code is added to the file. And if I work with it long anough, the controls
will disappear (happened to me yesterday). How the heck is this happening.
WHY IS THIS HAPPENING MS.
Whats strange is that I have other forms in the project that I created
before this problem and they are working as expected. I even tried copying
the code from a good form and deleting any reference to the controls (in the
old form) in the new form. It won't add the code for the new control in the
Form designer section. Sometimes I get an error
Error 70
'components' is already declared as 'Private Dim components As
System.ComponentModel.IContainer' in this class.

on the line:
"Private components As System.ComponentModel.IContainer"
when I paste the code into the new form. And there is no other references
(at least in this code file) to this line. Has anyone seen anything like
this. PLEASE Help.
Thanks
Mike
 
A

AlanT

How the form designer works has changed from '03 to '05.

'05 makes use of Parital classes and places all the formly known as
'Windows Form Designer Generated Code' in a separate file.

Click on the Show All Files button to show the new 'Form2.Designer.vb'
file

hth,
alan.
 
G

Guest

I have a question for you all. I've been diging some and have found some code
in the file frmRemarks.Designer.VB file that looks like the code that is
missing in the main (.vb) file. Here is the code:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Partial Class frmRemarks

Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.

<System.Diagnostics.DebuggerNonUserCode()> _

Protected Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing AndAlso components IsNot Nothing Then

components.Dispose()

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()

Me.SuspendLayout()

''frmRemark

'Me.ClientSize = New System.Drawing.Size(540, 266)

Me.Name = "frmRemarks"

Me.ResumeLayout(False)

End Sub

Friend WithEvents cmdSave As System.Windows.Forms.Button

Friend WithEvents cmdExit As System.Windows.Forms.Button

Friend WithEvents cmdCancel As System.Windows.Forms.Button

Friend WithEvents cmdAdd As System.Windows.Forms.Button

End Class



As you may have noticed that this version does not have the New constructor.
Is this where my problem lies. If so, why does this code now show up in this
file instead of the .VB file. Thanks for any info.

Michael
 
G

Guest

Ok Thanks for the help on that. I actually just noticed that and was going to
ask about that now, lol... Is this also the case for forms that came from
VS2003. Because most of my forms have the Designer code inside the .VB file.
Thanks again.
Michael
 
A

AlanT

A form that is converted from 2003 does not have a designer.vb and does
have a ctor with a call to InitializeComponent().

A form created under 2005 has a designer.vb file and does not have (nor
appear to need) a ctor - NOTE if you try to add a ctor to the class it
will add the call to InitializeComponent() for you and give a compiler
warning if you don't have one.

So a 'missing' new() function in a 2005 created form is not
neccessarily causing your problem.


I'm afraid that I haven't looked at the concepts much beyond this
point.

hth,
Alan.

hth,
Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top