Windows Forms: Initialize Component in VB .NET 2002

  • Thread starter Thread starter Armin Zingler
  • Start date Start date
A

Armin Zingler

Howard Kaikow said:
Where can I find more info on what we can do with code in the
Initialize Component?

You can do nothing in InitializeComponent. See the comment above the
procedure. It says: Do NOT use the code editor for modifications, use the
Form designer instead.
 
Is there documentation of what we should not change in the Initialize
Component of a Windows form?
For example, the following code was generated by VB .NET:

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(242, 223)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnGreeting,
Me.txtName, Me.lblInstruction})
Me.Menu = Me.OptionMenu
Me.Name = "frmHello"
Me.Text = "Hello"
Me.ResumeLayout(False)

I then changed the code to:

With Me
.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
.ClientSize = New System.Drawing.Size(242, 223)
.Controls.AddRange(New System.Windows.Forms.Control() _
{.btnGreeting, .txtName, .lblInstruction})
.Menu = .OptionMenu
.Name = "frmHello"
.Text = "Hello"
.ResumeLayout(False)
End With

This change caused the controls to vanish in designer view, but the code
still ran correctly.

Where can I find more info on what we can do with code in the Initialize
Component?
 
Hello,

Howard Kaikow said:
I'm not modifying, just making the code more efficient.

The designer seems to have problems if you use different rules for
formatting/writing the sourcecode. Some changes can be done by hand
(removing assignment of values to properties and so on), but always make
a copy before modifying.
 
Howard Kaikow said:
I'm not modifying, just making the code more efficient.

Whenever you are making the code more efficient, you are modifying the code.
 
Hi Howard,

I've not tested it but if the compiler's any good it will produce code
that does effectively what your With statement does.

There are a few modifications that you can get away with in this area.
Anything that makes it lose sync with the Form's resx file will cause
problems. In the worst case it will screw up the resx file completely and
you'll have to repopulate the Form from scratch.

I share your desire to tinker in that zone - it looks so messy. But that's
one use of Regions - to sweep mess (other people's, of course, lol) under the
carpet.

Regards,
Fergus
 
Hello,

Fergus Cooney said:
In the worst case it will screw up the resx file completely and
you'll have to repopulate the Form from scratch.

Or use a backup...

;-)
 
Hi Cor,

Grrr. Any more talk like that and you'll get <my> back up!!

Lol. ;-D

Regards,
Fergus

[Does that English make sense? It's funning and punning. :-)]
 
Fergus,
Yes that what I mean that kind of back up newsgroup, but not yours, yours is
a VB.net language group.
:-)
Cor
 
Hi Cor,

I thought I might have to explain. :-)

When you "get someone's back up", it means to make them angry. In the
sense of a hissing cat when it arches its back and fluffs up its fur. So I was
pretending to be angry so that I could use "backup" in that way.

Regards,
Fergus
 
Fergus,
Exactly the same as in Dutch, in Dutch it has to a literary meaning, but
that is probably in Cockney not the same?
:-)
Cor
 
Hello,

Fergus Cooney said:
|| Or use a backup...

What's a backup?

A copy of the project used to restore it if the original project is
damaged/lost.

;-)
 
Hello,

Cor said:
This is a news group about Vb.net.
For that question are other newsgroups .

"How to make a backup of a project using VB.NET?" -- the question is
related to VB.NET programming.

;-)
 
Hello,

Fergus Cooney said:
When you "get someone's back up", it means to make them angry.

I didn't know that... I used "backup" in the meaning of "copy".

;-)))
 
Hello,

Cor said:
Exactly the same as in Dutch, in Dutch it has to a literary meaning, but
that is probably in Cockney not the same?

In German (maybe Austrian dialect): "Du kannst mir den Buckel
runterrutschen"

;-)))
 
Hi Herfried,

Herfried said:
Du kannst mir den Buckel runterrutschen

http://ets.freetranslation.com/ said:
You can me the humpback down landslide.

Babel Fish Translation said:
You can down-slip me the embossment

Fergus translated:
You can slide down my arched back?

Fergus rephrased:
My back is so arched you could slide down it.

Fergus rephrased and took out all idiom:
I am considerably angry.

Fergus rephrased and put back the idiom:
I've really got the hump!

;-)

Regards,
Fergus
 
Back
Top