This is for a challenge I must do. It is two forms. I have it almost done, but my second form is not giving me a total. I can't figure it out. Thanks in advance!!
Here's the code:
Main form 1
Public Class MainForm1
Private Sub MainForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMainForm1 As New MainForm1
frmMainForm1.ShowDialog()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
' Closes the forms
Me.Close()
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim AllenHall As Integer = 1500
Dim PikeHall As Integer = 1600
Dim FathingHall As Integer = 1200
Dim UniversitySuites As Integer = 1800
If ListBox1.SelectedIndex = -1 Then
MessageBox.Show("Select a meal plan", "Error")
End If
If ListBox1.SelectedIndex = 0 Then
lblDormCost.Text = AllenHall.ToString
ElseIf ListBox1.SelectedIndex = 1 Then
lblDormCost.Text = PikeHall.ToString
ElseIf ListBox1.SelectedIndex = 2 Then
lblDormCost.Text = FathingHall.ToString
ElseIf ListBox1.SelectedIndex = 3 Then
lblDormCost.Text = UniversitySuites.ToString
End If
End Sub
Private Sub btnSelectMeal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectMeal.Click
Dim frmMealPlans As New frmMealPlans
frmMealPlans.ShowDialog()
End Sub
Public Sub frmMealPlans
End Sub
End Class
(Form 2)
Public Class frmMealPlans
Private Property Results As Object
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
' Close the form.
Me.Close()
End Sub
Private Sub BtnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEnter.Click
Dim Meals7 As Integer = 560
Dim Meals14 As Integer = 1095
Dim Unlimited As Integer = 1500
Dim Results As Integer
If ListBox1.SelectedIndex = -1 Then
MessageBox.Show("Select a meal plan", "Error")
End If
If ListBox1.SelectedIndex = 0 Then
Results = Meals7
ElseIf ListBox1.SelectedIndex = 1 Then
Results = Meals14
ElseIf ListBox1.SelectedIndex = 2 Then
Results = Unlimited
End If
End Sub
End Class