For the following prompt. I used 2 different codes but when start the program nothing shows up on the form. What am I doing wrong? Public Class frmMain Private mdlSample As Object Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Dormitory price in the list box ListBox1.Items.Add("Allen Hall - 2,500.00 ") ListBox1.Items.Add("Pike Hall - 2,200.00") ListBox1.Items.Add("Farthing Hall - 2,100.00") ListBox1.Items.Add("UniversitySuites - 2,800.00") End Sub Private Sub btnAddDormitory_Click(sender As Object, e As EventArgs) Handles btnAddDormitory.Click ' if user don't choose any price in list box Select Case ListBox1.SelectedIndex Case -1 MessageBox.Show("Select A Dormitory Please!") End Select 'Determine the value in Module and display the value of price to lblDormitory Select Case ListBox1.SelectedIndex Case 0 lblDormitory.Text = mdlSample.Allen_Hall.ToString("c2") Case 1 lblDormitory.Text = mdlSample.Pike_Hall.ToString("c2") Case 2 lblDormitory.Text = mdlSample.Farthing_Hall.ToString("c2") Case 3 lblDormitory.Text = mdlSample.UniversitySuites.ToString("c2") End Select End Sub Private Sub btnViewMP_Click(sender As Object, e As EventArgs) Handles btnViewMeal.Click 'Display the second form (Meal Plan) Me.Hide() frmMeal.Show() End Sub Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click 'Clear all the label except the list box lblDormitory.Text = String.Empty lblMealPlan.Text = String.Empty lblTotalCost.Text = String.Empty End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click ' Exit Program Application.Exit() End Sub End Class Module mdlSample 'Public constants for Dormitory prices and weedkly meal plan prices Public Const Allen_Hall As Decimal = 2500D Public Const Pike_Hall As Decimal = 2200D Public Const Farthing_Hall As Decimal = 2100D Public Const UniversitySuites As Decimal = 2800D Public Const Meal_Plan_7 As Decimal = 1560D Public Const Meal_Plan_14 As Decimal = 2095D Public Const Meal_Plan_Unilimited As Decimal = 2500D End Module Public Class frmMeal Private mdlSample As Object Private Sub btnAdd_MP_Click(sender As Object, e As EventArgs) Handles btnAddMealPlan.Click 'Declare the variable Dim MealPlans As Integer ' if user doesn't choose any Meal Plan then display message box Select Case lstMealPlans.SelectedIndex Case -1 MessageBox.Show("Select A Meal Plan Please!") End Select ' Determine the value in Module and display the value of price to lblMeal_Plan in form Main Select Case lstMealPlans.SelectedIndex Case 0 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_7.ToString("c2") MealPlans = NewMethod() Case 1 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_14.ToString("c2") MealPlans = MealPlans = NewMethod() Case 2 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_Unilimited.ToString("c2") MealPlans = MealPlans = NewMethod() End Select 'Calculate the total of Dormitory and Meal Plan and display it to form Main frmMain.lblTotalCost.Text = (frmMain.lblDormitory.Text + MealPlans).ToString("c2") 'Display to the form Main (frmMain) Me.Hide() Form1.Show() End Sub Private Function NewMethod() As Integer Return mdlSample.Meal_Plan_7.Integer("c2") End Function Private Sub frmMealPlans_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Weedkly Meal Plan price in the list box lstMealPlans.Items.Add("7 Meals - 1,560.00 ") lstMealPlans.Items.Add("14 Meals - 2,095.00") lstMealPlans.Items.Add("Unlimited Meals - 2,500.00") End Sub Private Sub btncClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click ' Close program Me.Close() End Sub End Class
For the following prompt. I used 2 different codes but when start the program nothing shows up on the form. What am I doing wrong? Public Class frmMain Private mdlSample As Object Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Dormitory price in the list box ListBox1.Items.Add("Allen Hall - 2,500.00 ") ListBox1.Items.Add("Pike Hall - 2,200.00") ListBox1.Items.Add("Farthing Hall - 2,100.00") ListBox1.Items.Add("UniversitySuites - 2,800.00") End Sub Private Sub btnAddDormitory_Click(sender As Object, e As EventArgs) Handles btnAddDormitory.Click ' if user don't choose any price in list box Select Case ListBox1.SelectedIndex Case -1 MessageBox.Show("Select A Dormitory Please!") End Select 'Determine the value in Module and display the value of price to lblDormitory Select Case ListBox1.SelectedIndex Case 0 lblDormitory.Text = mdlSample.Allen_Hall.ToString("c2") Case 1 lblDormitory.Text = mdlSample.Pike_Hall.ToString("c2") Case 2 lblDormitory.Text = mdlSample.Farthing_Hall.ToString("c2") Case 3 lblDormitory.Text = mdlSample.UniversitySuites.ToString("c2") End Select End Sub Private Sub btnViewMP_Click(sender As Object, e As EventArgs) Handles btnViewMeal.Click 'Display the second form (Meal Plan) Me.Hide() frmMeal.Show() End Sub Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click 'Clear all the label except the list box lblDormitory.Text = String.Empty lblMealPlan.Text = String.Empty lblTotalCost.Text = String.Empty End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click ' Exit Program Application.Exit() End Sub End Class Module mdlSample 'Public constants for Dormitory prices and weedkly meal plan prices Public Const Allen_Hall As Decimal = 2500D Public Const Pike_Hall As Decimal = 2200D Public Const Farthing_Hall As Decimal = 2100D Public Const UniversitySuites As Decimal = 2800D Public Const Meal_Plan_7 As Decimal = 1560D Public Const Meal_Plan_14 As Decimal = 2095D Public Const Meal_Plan_Unilimited As Decimal = 2500D End Module Public Class frmMeal Private mdlSample As Object Private Sub btnAdd_MP_Click(sender As Object, e As EventArgs) Handles btnAddMealPlan.Click 'Declare the variable Dim MealPlans As Integer ' if user doesn't choose any Meal Plan then display message box Select Case lstMealPlans.SelectedIndex Case -1 MessageBox.Show("Select A Meal Plan Please!") End Select ' Determine the value in Module and display the value of price to lblMeal_Plan in form Main Select Case lstMealPlans.SelectedIndex Case 0 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_7.ToString("c2") MealPlans = NewMethod() Case 1 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_14.ToString("c2") MealPlans = MealPlans = NewMethod() Case 2 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_Unilimited.ToString("c2") MealPlans = MealPlans = NewMethod() End Select 'Calculate the total of Dormitory and Meal Plan and display it to form Main frmMain.lblTotalCost.Text = (frmMain.lblDormitory.Text + MealPlans).ToString("c2") 'Display to the form Main (frmMain) Me.Hide() Form1.Show() End Sub Private Function NewMethod() As Integer Return mdlSample.Meal_Plan_7.Integer("c2") End Function Private Sub frmMealPlans_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Weedkly Meal Plan price in the list box lstMealPlans.Items.Add("7 Meals - 1,560.00 ") lstMealPlans.Items.Add("14 Meals - 2,095.00") lstMealPlans.Items.Add("Unlimited Meals - 2,500.00") End Sub Private Sub btncClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click ' Close program Me.Close() End Sub End Class
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
For the following prompt. I used 2 different codes but when start the program nothing shows up on the form. What am I doing wrong?
Public Class frmMain
Private mdlSample As Object
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Display the Dormitory price in the list box
ListBox1.Items.Add("Allen Hall - 2,500.00 ")
ListBox1.Items.Add("Pike Hall - 2,200.00")
ListBox1.Items.Add("Farthing Hall - 2,100.00")
ListBox1.Items.Add("UniversitySuites - 2,800.00")
End Sub
Private Sub btnAddDormitory_Click(sender As Object, e As EventArgs) Handles btnAddDormitory.Click
' if user don't choose any price in list box
Select Case ListBox1.SelectedIndex
Case -1
MessageBox.Show("Select A Dormitory Please!")
End Select
'Determine the value in Module and display the value of price to lblDormitory
Select Case ListBox1.SelectedIndex
Case 0
lblDormitory.Text = mdlSample.Allen_Hall.ToString("c2")
Case 1
lblDormitory.Text = mdlSample.Pike_Hall.ToString("c2")
Case 2
lblDormitory.Text = mdlSample.Farthing_Hall.ToString("c2")
Case 3
lblDormitory.Text = mdlSample.UniversitySuites.ToString("c2")
End Select
End Sub
Private Sub btnViewMP_Click(sender As Object, e As EventArgs) Handles btnViewMeal.Click
'Display the second form (Meal Plan)
Me.Hide()
frmMeal.Show()
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
'Clear all the label except the list box
lblDormitory.Text = String.Empty
lblMealPlan.Text = String.Empty
lblTotalCost.Text = String.Empty
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
' Exit Program
Application.Exit()
End Sub
End Class
Module mdlSample
'Public constants for Dormitory prices and weedkly meal plan prices
Public Const Allen_Hall As Decimal = 2500D
Public Const Pike_Hall As Decimal = 2200D
Public Const Farthing_Hall As Decimal = 2100D
Public Const UniversitySuites As Decimal = 2800D
Public Const Meal_Plan_7 As Decimal = 1560D
Public Const Meal_Plan_14 As Decimal = 2095D
Public Const Meal_Plan_Unilimited As Decimal = 2500D
End Module
Public Class frmMeal
Private mdlSample As Object
Private Sub btnAdd_MP_Click(sender As Object, e As EventArgs) Handles btnAddMealPlan.Click
'Declare the variable
Dim MealPlans As Integer
' if user doesn't choose any Meal Plan then display message box
Select Case lstMealPlans.SelectedIndex
Case -1
MessageBox.Show("Select A Meal Plan Please!")
End Select
' Determine the value in Module and display the value of price to lblMeal_Plan in form Main
Select Case lstMealPlans.SelectedIndex
Case 0
frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_7.ToString("c2")
MealPlans = NewMethod()
Case 1
frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_14.ToString("c2")
MealPlans = MealPlans = NewMethod()
Case 2
frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_Unilimited.ToString("c2")
MealPlans = MealPlans = NewMethod()
End Select
'Calculate the total of Dormitory and Meal Plan and display it to form Main
frmMain.lblTotalCost.Text = (frmMain.lblDormitory.Text + MealPlans).ToString("c2")
'Display to the form Main (frmMain)
Me.Hide()
Form1.Show()
End Sub
Private Function NewMethod() As Integer
Return mdlSample.Meal_Plan_7.Integer("c2")
End Function
Private Sub frmMealPlans_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Display the Weedkly Meal Plan price in the list box
lstMealPlans.Items.Add("7 Meals - 1,560.00 ")
lstMealPlans.Items.Add("14 Meals - 2,095.00")
lstMealPlans.Items.Add("Unlimited Meals - 2,500.00")
End Sub
Private Sub btncClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
' Close program
Me.Close()
End Sub
End Class
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
This code still has errors and the
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education