maia_18
New member
- Joined
- Jul 22, 2011
- Messages
- 4
- Programming Experience
- Beginner
hi.... i have a noob problem on dealing with multiple forms... its supposed to have 3 forms... form 1 is where i enter my id and name in their respective textboxes, choose my course from a coursebox, and choose my year on a coursebox... when i click on "Next", form 2 appears... form 2 is where i enter my address in two textboxes, my contact no. and my birthdate... then there is a procedure for calculating my age, which will be displayed in a disabled textbox... when i click "next" again, form 3 appears and is supposed to display all that i've entered...
the problem is, my form 3 only displays the data i've entered in form 1.. it does not display the stuff i entered in form 2... please help....
code:
form 1:
form 2:
form 3:
thanks!!! i really don't know where to look for my error...
the problem is, my form 3 only displays the data i've entered in form 1.. it does not display the stuff i entered in form 2... please help....
code:
form 1:
VB.NET:
Public Class Form1
Public id As String
Public names As String
Public course As String
Public year As String
Public address1 As String
Public address2 As String
Public contact As String
Public bdate As String
Public age As Integer
Private Sub courseBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles courseBox.SelectedIndexChanged
If courseBox.SelectedItem Is "BSCoE" Then
course = CStr(courseBox.SelectedItem)
ElseIf courseBox.SelectedItem Is "BSCS" Then
yearBox.Items.Remove("5")
course = CStr(courseBox.SelectedItem)
ElseIf courseBox.SelectedItem Is "DCET" Or courseBox.SelectedItem Is "DIT" Or courseBox.SelectedItem Is "HRS" Then
yearBox.Items.Remove("5")
yearBox.Items.Remove("4")
yearBox.Items.Remove("3")
course = CStr(courseBox.SelectedItem)
End If
End Sub
Private Sub yearBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles yearBox.SelectedIndexChanged
year = yearBox.SelectedItem
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
id = CStr(idBox.Text)
names = CStr(nameBox.Text)
Me.Hide()
Dim nextform As New Form2
nextform.Show()
End Sub
End Class
form 2:
VB.NET:
Public Class Form2 Public address1 As String
Public address2 As String
Public contactno As String
Public bday As String
Public age As Single
Private Sub dateBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles dateBox.LostFocus
age = DateDiff(DateInterval.Year, CDate(dateBox.Text), Now)
ageBox.Text = age
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
address1 = CStr(add1.Text)
address2 = CStr(add2.Text)
contactno = CStr(contact.Text)
bday = CStr(dateBox.Text)
Me.Hide()
Dim nextfrm As New Form3
nextfrm.Show()
End Sub
End Class
form 3:
VB.NET:
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
idbox.Text = Form1.id
namebox.Text = Form1.names
coursebox.Text = Form1.course
yearbox.Text = Form1.year
addbox1.Text = Form2.address1
addbox2.Text = Form2.address2
contactbox.Text = Form2.contactno
bdaybox.Text = Form2.bday
agebox.Text = Form2.age
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
Form1.Close()
Form2.Close()
End Sub
End Class
thanks!!! i really don't know where to look for my error...