Option Strict On
Public Class frmweeklypaycalculator
'
Const cintNumberOfMinutesInHour As Integer = 60
Private Sub btnweeklypay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWeeklyPay.Click
' This event handler is executed when the user clicks the
' Weekly Pay button. It calculates and displays the
' number of hours worked (total minutes worked divided by
' 60), the number of minutes worked (use mod operator to
' times hour remainder by 60), and the Total amount to
' be paid (hours worked times hourly pay rate).
Dim strTotalMinutesWorked As String
Dim intTotalMinutesWorked As Integer
Dim strHourlyPayRate As String
Dim decHourlyPayRate As Decimal
Dim intTotalHoursWorked As Integer
Dim intTotalLeftoverMinutes As Integer
Dim decTotalWeeklyPay As Decimal
strTotalMinutesWorked = Me.txtTotalMinutesWorked.Text
strHourlyPayRate = Me.txtHourlyPayRate.Text
intTotalHoursWorked = intTotalMinutesWorked \ 60
intTotalMinutesWorked = intTotalLeftoverMinutes Mod 60
decTotalWeeklyPay = Convert.ToDecimal(intTotalMinutesWorked) / _
Convert.ToDecimal(cintNumberOfMinutesInHour = 60) * decHourlyPayRate
Me.lblTotalHoursWorked.Text = decHourlyPayRate.ToString("")
Me.lblTotalWeeklyPay.Text = decTotalWeeklyPay.ToString("C")
Me.lblTotalLeftoverMinutes.Text = intTotalLeftoverMinutes.ToString("")
Me.lblTotalHoursWorked.Text = decTotalWeeklyPay.ToString("")
Me.lblTotalWeeklyPay.Text = decTotalWeeklyPay.ToString("C")
Me.lblTotalLeftoverMinutes.Text = intTotalLeftoverMinutes.ToString("")
End Sub
Private Sub Btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
' This Event Handler is executed when the user clicks the
' clear button. It clears the number of mintutes worked text box,
' the text property of minutes worked, the hourly rate text box,
' the textproperty of hours worked, and the text propoerty of
' weekly pay.
Me.txtTotalMinutesWorked.Clear()
Me.txtHourlyPayRate.Clear()
Me.lblTotalHoursWorked.Text = ""
Me.lblTotalWeeklyPay.Text = ""
Me.lblTotalLeftoverMinutes.Text = ""
Me.txtTotalMinutesWorked.Focus()
End Sub
Private Sub Btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
' This event handler is executed when the user clicks the
' Exit button. It closes the window and terminates the
' application.
Me.Close()
End Sub
End Class
If someone could help give me a push in the right direction that would be great I'm just starting this and I'm very new to it



This should not be in the code twice
Me.lblTotalHoursWorked.Text = decHourlyPayRate.ToString("")
Me.lblTotalWeeklyPay.Text = decTotalWeeklyPay.ToString("C")
Me.lblTotalLeftoverMinutes.Text = intTotalLeftoverMinutes.ToString("")
This post has been edited by AdamSpeight2008: 09 March 2011 - 10:03 PM

New Topic/Question
Reply



MultiQuote








|