From: Mr. X. on
Hello.
I have an inherited windows-form class : MyForm.
When I put component on it - I see many code behind (and when I do on a
original windows form, I don't get an automatic code behind).

Form is declared :
Public Class MyForm
Inherits Form

Public Sub New()
MyClass.New(Nothing)
End Sub

Public Sub New(ByRef dt As DataTable)
MyBase.New()
...
End Sub
End Class

When I do another form like this (It is declared as a class) :
Public Class frmTest
Inherits MyForm
....


When I just put a button on the form I get a auto-generated source on the
code :

Friend WithEvents Button1 As System.Windows.Forms.Button
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(506, 83)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(67, 58)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'frmTest
'
Me.ClientSize = New System.Drawing.Size(744, 218)
Me.Controls.Add(Me.Button1)
Me.Name = "frmTest"
Me.ResumeLayout(False)

End Sub

Why I getting that automatic code, and how can I avid getting the
auto-generated code behind (or see it elsewhere) ?

Thanks :)



From: Mr. X. on
Maybe this is related :
I cannot see InitializeComponent on MyForm.

Thanks :)
From: Armin Zingler on
Am 26.04.2010 00:48, schrieb Mr. X.:
> Why I getting that automatic code, and how can I avid getting the
> auto-generated code behind (or see it elsewhere) ?

You always get the automatic code, but by default it's in the *.Designer.vb file.
Show "all files" in the solution explorer (click the icon at the top) and you'll
see a "+" sign in front of "form1.vb". Open it to see the designer file.

Without using the Form template, the automatic code is always put in your
own class file. I don't know how the designer finds out where to put it,
so I can't tell you if it were possible to force him to put it somewhere
else.

--
Armin
From: Mr. X. on
For the new form I don't get the code in *.Designer.vb, but on the
myForm.vb itself
Is there any way to declare there is a designer behind (another vb) ?

Thanks :)

"Armin Zingler" <az.nospam(a)freenet.de> wrote in message
news:#xR6g$M5KHA.6132(a)TK2MSFTNGP05.phx.gbl...
> Am 26.04.2010 00:48, schrieb Mr. X.:
>> Why I getting that automatic code, and how can I avid getting the
>> auto-generated code behind (or see it elsewhere) ?
>
> You always get the automatic code, but by default it's in the
> *.Designer.vb file.
> Show "all files" in the solution explorer (click the icon at the top) and
> you'll
> see a "+" sign in front of "form1.vb". Open it to see the designer file.
>
> Without using the Form template, the automatic code is always put in your
> own class file. I don't know how the designer finds out where to put it,
> so I can't tell you if it were possible to force him to put it somewhere
> else.
>
> --
> Armin

From: Armin Zingler on
Am 26.04.2010 01:52, schrieb Mr. X.:
> For the new form I don't get the code in *.Designer.vb, but on the
> myForm.vb itself

Right, that's what I wrote:
>> Without using the Form template, the automatic code is always put in your
>> own class file.

> Is there any way to declare there is a designer behind (another vb) ?

As I wrote:
>> I don't know how the designer finds out where to put it,
>> so I can't tell you if it were possible to force him to put it somewhere
>> else.


--
Armin
 |  Next  |  Last
Pages: 1 2
Prev: Option strict
Next: Resize an image: bug?