palehorse
Active member
- Joined
- Jan 28, 2005
- Messages
- 34
- Programming Experience
- 1-3
Hello All,
To start off, I am new at programming.
I have a school project that has me stumped and for some time now at that.
Form1 has textboxes and a button. When the button is pressed, thevalues of these textboxes are passed to the textboxes on Form2. WhenForm2 loads, it creates a child form, Form3 and at the same time,passesthe values of Form2's textboxes to the textboxes in Form3.There is abutton on Form2 and when pressed, it passes the values of Form2'stextboxes to Form4. Form4 then loads and the load event generates asimple message.
This all works the first time around, however - the second time around,I change the values of Form1's textboxes and click the button...Form2shows them fine, the child form, Form3 does not and when I click thebutton on Form2, the values are passed to Form4 fine, but the loadevent of Form4 doesn't happen?
Form1:
Form2:
Form4
I have been working at this and have been to many forums without a fix. I hope I can get this issue resolved.
Thank you,
Scott
To start off, I am new at programming.
I have a school project that has me stumped and for some time now at that.
Form1 has textboxes and a button. When the button is pressed, thevalues of these textboxes are passed to the textboxes on Form2. WhenForm2 loads, it creates a child form, Form3 and at the same time,passesthe values of Form2's textboxes to the textboxes in Form3.There is abutton on Form2 and when pressed, it passes the values of Form2'stextboxes to Form4. Form4 then loads and the load event generates asimple message.
This all works the first time around, however - the second time around,I change the values of Form1's textboxes and click the button...Form2shows them fine, the child form, Form3 does not and when I click thebutton on Form2, the values are passed to Form4 fine, but the loadevent of Form4 doesn't happen?
Form1:
VB.NET:
Public Class Form1
Inherits System.Windows.Forms.Form
'Windows Form Designer generated code
Private FirstForm As New Form2
Private Sub btnShowForm_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) Handles btnShowForm.Click
FirstForm.Label1.Text = Me.TextBox1.Text
FirstForm.Label2.Text = Me.TextBox2.Text
FirstForm.Label3.Text = Me.TextBox3.Text
FirstForm.Label4.Text = Me.TextBox4.Text
FirstForm.Show()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
VB.NET:
Public Class Form2
Inherits System.Windows.Forms.Form
'Windows Form Designer generated code
Private ChildForm As New Form3
Private MessageForm As New Form4
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Hide()
End Sub
Private Sub btnShowForm_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) Handles btnShowForm.Click
MessageForm.TextBox1.Text = Me.TextBox1.Text
MessageForm.TextBox2.Text = Me.TextBox2.Text
MessageForm.TextBox3.Text = Me.TextBox3.Text
MessageForm.TextBox4.Text = Me.TextBox4.Text
Me.Hide()
MessageForm.Show()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ChildForm.TopLevel = False
ChildForm.Parent = Me
ChildForm.Location = (New Point(16, 16))
ChildForm.Show()
ChildForm.TextBox1.Text = Me.TextBox1.Text
ChildForm.TextBox2.Text = Me.TextBox2.Text
ChildForm.TextBox3.Text = Me.TextBox3.Text
ChildForm.TextBox4.Text = Me.TextBox4.Text
End Sub
VB.NET:
Public Class Form4
Inherits System.Windows.Forms.Form
'Windows Form Designer generated code
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox("The Form Is Working!")
Me.Hide()
End Sub
I have been working at this and have been to many forums without a fix. I hope I can get this issue resolved.
Thank you,
Scott
Last edited: