here are the form i used, Public Class frmMain Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Dormitory price in the list box lstDormitories.Items.Add("Allen Hall - 2,500.00 ") lstDormitories.Items.Add("Pike Hall - 2,200.00") lstDormitories.Items.Add("Farthing Hall - 2,100.00") lstDormitories.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 lstDormitories.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 lstDormitories.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 Public Class frmMeal Private Sub frmMeal_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Weekly 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 btnAddMealPlan_Click(sender As Object, e As EventArgs) Handles btnAddMealPlan.Click Dim MealPlans As Decimal 'Declare the variable ' 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 = mdlsample.Meal_Plan_7.ToString("c2") Case 1 frmMain.lblMealPlan.Text = mdlsample.Meal_Plan_14.ToString("c2") MealPlans = mdlsample.Meal_Plan_14.ToString("c2") Case 2 frmMain.lblMealPlan.Text = mdlsample.Meal_Plan_Unilimited.ToString("c2") MealPlans = mdlsample.Meal_Plan_Unilimited.ToString("c2") 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 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 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 I have no errors but when I start the program it is blank. How do i fix this?
here are the form i used,
Public Class frmMain
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Display the Dormitory price in the list box
lstDormitories.Items.Add("Allen Hall - 2,500.00 ")
lstDormitories.Items.Add("Pike Hall - 2,200.00")
lstDormitories.Items.Add("Farthing Hall - 2,100.00")
lstDormitories.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 lstDormitories.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 lstDormitories.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
Application.Exit()
End Sub
End Class
Public Class frmMeal
Private Sub frmMeal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Display the Weekly 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 btnAddMealPlan_Click(sender As Object, e As EventArgs) Handles btnAddMealPlan.Click
Dim MealPlans As Decimal
'Declare the variable
' 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 = mdlsample.Meal_Plan_7.ToString("c2")
Case 1
frmMain.lblMealPlan.Text = mdlsample.Meal_Plan_14.ToString("c2")
MealPlans = mdlsample.Meal_Plan_14.ToString("c2")
Case 2
frmMain.lblMealPlan.Text = mdlsample.Meal_Plan_Unilimited.ToString("c2")
MealPlans = mdlsample.Meal_Plan_Unilimited.ToString("c2")
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 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
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
I have no errors but when I start the program it is blank. How do i fix this?
There could be several reasons why your program is blank when you start it. Here are some possible solutions:
-
Check if the forms are set as the startup form: Make sure that the form you want to display first is set as the startup form. You can do this by right-clicking on the form in the Solution Explorer, selecting "Set as StartUp Form", and then running the program again.
-
Check if the controls are visible: Make sure that the controls on the form are set to Visible. You can do this by selecting the control and checking the Visible property in the Properties window.
-
Check if the controls are properly positioned: Make sure that the controls are properly positioned on the form. If they are positioned outside the visible area of the form, they may not be visible when the form is displayed.
-
Check if the controls are properly sized: Make sure that the controls are properly sized. If they are too small, they may not be visible when the form is displayed.
-
Check if the controls are properly anchored: Make sure that the controls are properly anchored. If they are not anchored to the edges of the form, they may not be visible when the form is resized.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps