I really would appreciate it if someone could help me troubleshoot this code for my class. I am trying to get it to take input from textboxes and put the output into a list when the user clicks a button and likewise hide the list when the user clicks the close button. Right now I am having issues in my getInputs sub. Any help would be much appreciated.
Option Strict On
Public Class frmExpense
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Org As String = ""
Dim dateOf As String = ""
Dim Location As String = ""
Dim MandE As Double = 0.0
Dim Airline As Double = 0.0
Dim Lodge As Double = 0.0
Dim Taxi As Double = 0.0
Dim Deductible As Double = 0.0
Dim TotalExp As Double = 0.0
getInputs(Org, dateOf, Location, MandE, Airline, Lodge, Taxi)
CalculateDeductible(MandE, Deductible)
calculateTotal(Airline, Lodge, Taxi, TotalExp)
Display(Org, dateOf, Location, MandE, Airline, Lodge, Taxi, Deductible, TotalExp)
End Sub
Sub getInputs(ByVal Org As String, ByVal theDate As String, ByVal Place As String, ByVal Meals As Double, ByVal Plane As Double, ByVal Hotel As Double, ByVal Ride As Double)
Org = Convert.ToString(txtOrg.Text)
theDate = Convert.ToString(txtDate.Text)
Place = Convert.ToString(txtLocation.Text)
Plane = Convert.ToDouble(txtAirline.Text)
Meals = Convert.ToDouble(txtMandE.Text)
Hotel = Convert.ToDouble(txtLodge.Text)
Ride = Convert.ToDouble(txtTaxi.Text)
End Sub
Sub CalculateDeductible(ByRef mealDeductible As Double, ByVal MandE As Double)
mealDeductible = MandE / 2
End Sub
Sub calculateTotal(ByRef totalExp As Double, ByRef Airline As Double, ByRef Lodge As Double, ByRef Taxi As Double)
totalExp = Airline + Lodge + Taxi
End Sub
Sub Display(ByVal Ent As String, ByVal theDate As String, ByVal Place As String, ByVal Meals As Double, ByVal Plane As Double, ByVal Hotel As Double, ByVal Ride As Double, ByVal Deductible As Double, ByVal totalExp As Double)
Dim fmtStr As String = "{0,-24}{1,12}"
Dim fmtStr2 As String = "{0,32}{1,12}"
lstResult.Items.Add("Business Travel Expense")
lstResult.Items.Add("")
lstResult.Items.Add("Trip to attend meeting of")
lstResult.Items.Add(Ent)
lstResult.Items.Add(String.Format(theDate, "in", Place))
lstResult.Items.Add("")
lstResult.Items.Add(String.Format(fmtStr, "Meals and Entertainment", FormatCurrency(Meals, 2)))
lstResult.Items.Add(String.Format(fmtStr, "Airplane fare", FormatCurrency(Plane, 2)))
lstResult.Items.Add(String.Format(fmtStr, "Lodging", FormatCurrency(Hotel, 2)))
lstResult.Items.Add(String.Format(fmtStr, "Taxi Fares", FormatCurrency(Ride, 2)))
lstResult.Items.Add(String.Format(fmtStr2, "Total Other than Meals and Entertainment: ", FormatCurrency(totalExp, 2)))
lstResult.Items.Add(String.Format(fmtStr2, "50% of Meals and Entertainment: ", FormatCurrency(Deductible, 2)))
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
lstResult.Visible = False
End Sub
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
lstResult.Visible = True
End Sub
End Class