Scott,
Did you read the comment just before the routine? :-)
'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()
Sometimes the designer will put your controls (variables) between the
comments & InitializeComponent.
Is this normal behavior?
Yes, the routine belongs to the Designer, it will be replaced when you
modify the control in the designer. As the above comment states, do not
modify the InitializeComponent routine!
Is there a better place for this code?
Yes, put your code in the constructor, after the call to
InitializeComponent, there is a comment indicating where.
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
' **** put your code here **** '
End Sub
Hope this helps
Jay
"Scott Kilbourn" <skilbourn@NO_SPAM_PLEASE.appliedsystems.com> wrote in
message news:e%****************@TK2MSFTNGP12.phx.gbl... Hi,
I added some custom code to the InitalizeComponent function of a control
that I'm working on. Every once in a while, I've noticed that the code
that I added disappears. I finally tracked it down, and it seems that the code
disappears whenever I make a change to the UI of the control. For
instance, I just resized the control in the IDE, and my code disappeared.
Is this normal behavior? Is there a better place for this code? The code
that I inserted into InitializeComponent has to run before the
OnSizeChanged event runs.
Thanks