Re: Windows Form Designer generated code
- From: cj <cj@xxxxxxxxxxxxx>
- Date: Fri, 12 Jan 2007 13:59:16 -0500
in which .vb file. form1.vb or form1.designer.vb?
Martin wrote:
Hi CJ,.
in 2005 if you type 'Public Sub New' in the .vb file and press return the editor will auto-generate the code:-
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
You can add your code after the 'Add any....' comment
HTH
"cj" <cj@xxxxxxxxxxxxx> wrote in message news:u5WmI4lNHHA.2028@xxxxxxxxxxxxxxxxxxxxxxxIn a project done in 2003 about a year ago I was told to add the SocketWrench code below into the Windows Form Designer generated code area as shown below.
#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
socket = New SocketWrenchCtl.SocketWrench
If socket.Initialize("ELMO") <> 0 Then
Throw New System.Exception("Unable to initialize control")
End If
End Sub
I'm completing a 2005 program now that was so similar I copied many parts of the old 2003 program but I'm not sure what to do with this code. I know 2005 keeps the Windows Form Designer generated code somewhere but I really don't want to add it there unless it is really necessary. Apparently it can go in Form1_Load but I'm not sure that's appropriate. Where should I put it in 2005? Pros and cons?
- Follow-Ups:
- Re: Windows Form Designer generated code
- From: RobinS
- Re: Windows Form Designer generated code
- References:
- Windows Form Designer generated code
- From: cj
- Windows Form Designer generated code
- Prev by Date: Re: Function Warning - Null Reference
- Next by Date: Re: Windows Form Designer generated code
- Previous by thread: Re: Windows Form Designer generated code
- Next by thread: Re: Windows Form Designer generated code
- Index(es):
Relevant Pages
|