kera 0 Newbie Poster

I need to create an application with two forms. The startup form holds the names of the dormitories and the other holds the meal plans. When the user selects a dormitory and meal plan, the application should show the total charges for the semester on the startup form.

Here is what I have. I did not do this code it was sort of hammy-down. I have no clue how the design should look and what buttons to have. I need serious help.

This is the code for form1:Public Class Form1
Dim TotalCost As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frmMainForm1 As New Form1

frmMainForm1.ShowDialog()
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Closes the forms
Me.Close()
End Sub

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim AllenHall As Integer = 1500
Dim PikeHall As Integer = 1600
Dim FarthingHall As Integer = 1200
Dim UniversitySuites As Integer = 1800
Dim Cost As Integer


Select Case ListBox1.SelectedIndex
Case -1
MessageBox.Show("Select a meal plan")
Case 0
lblDormCost.Text = AllenHall.ToString
Cost = AllenHall
Case 1
lblDormCost.Text = PikeHall.ToString
Cost = PikeHall
Case 2
lblDormCost.Text = FarthingHall.ToString
Cost = FarthingHall
Case 3
lblDormCost.Text = UniversitySuites.ToString
Cost = UniversitySuites
End Select
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim frmMealPlans As New MealPlans

frmMealPlans.Show()
End Sub
End Class


This is the code for Form2:Public Class MealPlans

Private Sub MealPlans_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim TotalCost As Integer
Dim HallCost As Integer
Dim Results As Integer
End Sub

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
'Closes 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

Select Case ListBox1.SelectedIndex
Case -1
MessageBox.Show("Select a meal plan")
Case 0
Rseults = Meals7
Case 1
Results = Meals14
Case 2
Results = Unlimited
End Select

Label1.Text = Results.ToString


End Sub

Public Sub Calculate(ByVal hallcost As Integer)
Dim AllenHall As Integer = 1500
Dim PikeHall As Integer = 1600
Dim FarthingHall As Integer = 1200
Dim UniversitySuites As Integer = 1800
Dim Cost As Integer

Select Case Form1.ListBox1.SelectedIndex

Case 0
Form1.lblDormCost.Text = PikeHall.ToString
Cost = AllenHall
Case 1
Form1.lblDormCost.Text = PikeHall.ToString
Cost = PikeHall
Case 2
Form1.lblDormCost.Text = FarthingHall.ToString
Cost = FarthingHall
Case 3
Form1.lblDormCost.Text = UniversitySuites.ToString
Cost = UniversitySuites
End Select
TotalCost = Cost + Results
Form1.lblMealCost.Text = TotalCost.ToString
End Sub
End Class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.