| View previous topic :: View next topic |
| Author |
Message |
killersamurai Expert Cheater
Reputation: 0
Joined: 10 Sep 2007 Posts: 197 Location: Colorado
|
Posted: Wed Feb 13, 2008 11:24 am Post subject: |
|
|
| Naablet wrote: |
| Code: | Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMain As New Form
frmMain.Height = 400
frmMain.Width = 600
frmMain.Show()
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim txtuser As New TextBox
Me.Controls.Add(txtuser)
End Sub
End Class |
|
One thing is the load event will never happen. You forgot to add the event.
| Code: |
frmMain.Load += new System.EventHandler(Me.frmMain_Load);
|
You can always put frmMain out side of Form1_Load. That way, you can access frmMain inside of frmMain_Load
| Code: |
Private frmMain As New Form()
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
frmMain.Height = 400
frmMain.Width = 600
frmMain.Top = 0
frmMain.Left = 0
AddHandler frmMain.Load, AddressOf Me.frmMain_Load
frmMain.Show()
End Sub
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim txtTest As New TextBox()
txtTest.Name = "test"
txtTest.Location = New Point(0, 0)
txtTest.Size = New Size(50, 20)
frmMain.Controls.Add(txtTest)
End Sub
|
|
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Wed Feb 13, 2008 12:55 pm Post subject: |
|
|
Could i ask why you need to "remplace" the "Me" from the original form to a outside class? _________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8588 Location: 127.0.0.1
|
|
| Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Thu Feb 14, 2008 2:54 am Post subject: |
|
|
sorry _________________
Intel over amd yes. |
|
| Back to top |
|
 |
|