I need someone to explain to me why this code constantly returns a 0 value when I attmept to run this program. I'm about at my witts end and ready to jump out of a window of a very tall building!
I only have two subs posted here. I am continually getting a 0 when I hit the calc button. I believe the function is being called correctly and I have it in a logical statement correctly. Just looking for some incite.HTML Code:Public Class FrmTravel 'Define all variables to be used within the application 'both locally and form wide. Dim decDays As Decimal Dim decAirfare As Decimal Dim decCarRentals As Decimal Dim sngMiles As Single Dim decParkingFees As Decimal Dim decTaxi As Decimal Dim decSeminar As Decimal Dim decLodging As Decimal Dim decTotalCost As Decimal Dim decAmountExempt As Decimal Dim decEndCost As Decimal Dim decMeals As Decimal 'price put in by user Dim decMealIncurred As Decimal 'price going in incurred txtbox Dim decMealTotal As Decimal Dim decMealExempt As Decimal 'going into the exempt txtbox 'All constants listed. Each value is the maximum 'amount that is reimbursable by the company. Const conMEALS As Decimal = 37D Const conPARKINGFEES As Decimal = 10D Const conTAXI As Decimal = 20D Const conLODGING As Decimal = 95D Const conPRIVATE As Decimal = 0.27D 'Submit the calcMeals sub to determine the cost of food 'and what is reimbursable. Function calcMeals() As Decimal decDays = CDec(cboDays.SelectedItem().ToString) decMeals = CDec(txtMeals.Text.ToString) decMealTotal = decMeals / decDays Return decMealTotal End Function Private Sub btnCalcCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcCost.Click 'process to begin reimbursement of money if any is due. If calcMeals() > conMEALS Then lblTotalCost.Text = FormatCurrency(CDec(calcMeals())) End If
Thanks,
Abe





Reply With Quote