Procbyval

 

Public Class FrmProc

Inherits System.Windows.Forms.Form

Windows Form Designer generated code

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

intHrs = CType(txtHrs.Text, Integer)

'intHrs = CInt(txtHrs.Text)

decPayHr = CType(txtPayHr.Text, Decimal)

'decPayHr = Convert.ToDecimal(txtPayHr.Text)

'decPayHr = CDec(txtPayHr.Text)

Directions()

CalcPay(intHrs, decPayHr)

End Sub

Sub Directions()

lstPay.Items.Add("Code multiplies hours by pay per hour")

End Sub

Sub CalcPay(ByVal intHrs As Integer, ByVal decPayHr As Decimal)

Dim decPay As Decimal

decPay = intHrs * decPayHr

lstPay.Items.Add("The pay is: " & decPay)

End Sub

End Class

 

Procbyval1

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

intHrs = CType(txtHrs.Text, Integer)

'intHrs = CInt(txtHrs.Text)

decPayHr = CType(txtPayHr.Text, Decimal)

'decPayHr = Convert.ToDecimal(txtPayHr.Text)

'decPayHr = CDec(txtPayHr.Text)

Directions()

CalcPay(intHrs, decPayHr)

lstPay.Items.Add("Pay per hour from click event: " & decPayHr)

lstPay.Items.Add("The pay from click event is: " & intHrs * decPayHr)

End Sub

Sub Directions()

lstPay.Items.Add("Code multiplies hours by pay per hour")

End Sub

Sub CalcPay(ByVal intHrs As Integer, ByVal decPayHr As Decimal)

Dim decPay As Decimal

decPayHr = decPayHr * 2

lstPay.Items.Add("Pay per hour from sub: " & decPayHr)

decPay = intHrs * decPayHr

lstPay.Items.Add("The pay from sub is: " & decPay)

End Sub

End Class

Procbyval2

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

intHrs = CType(txtHrs.Text, Integer)

'intHrs = CInt(txtHrs.Text)

decPayHr = CType(txtPayHr.Text, Decimal)

'decPayHr = Convert.ToDecimal(txtPayHr.Text)

'decPayHr = CDec(txtPayHr.Text)

Directions()

CalcPay(intHrs, decPayHr)

lstPay.Items.Add("Pay per hour from click event: " & decPayHr)

lstPay.Items.Add("The pay from click event is: " & intHrs * decPayHr)

End Sub

Sub Directions()

lstPay.Items.Add("Code multiplies hours by pay per hour")

End Sub

Sub CalcPay(ByVal intHrsProc As Integer, ByVal decPayHrProc As Decimal)

Dim decPay As Decimal

decPayHrProc = decPayHrProc * 2

lstPay.Items.Add("Pay per hour from sub: " & decPayHrProc)

decPay = intHrsProc * decPayHrProc

lstPay.Items.Add("The pay from sub is: " & decPay)

End Sub

End Class

 

Procbyref1

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

intHrs = CType(txtHrs.Text, Integer)

'intHrs = CInt(txtHrs.Text)

decPayHr = CType(txtPayHr.Text, Decimal)

'decPayHr = Convert.ToDecimal(txtPayHr.Text)

'decPayHr = CDec(txtPayHr.Text)

Directions()

CalcPay(intHrs, decPayHr)

lstPay.Items.Add("Pay per hour from click event: " & decPayHr)

lstPay.Items.Add("The pay from click event is: " & intHrs * decPayHr)

End Sub

Sub Directions()

lstPay.Items.Add("Code multiplies hours by pay per hour")

End Sub

Sub CalcPay(ByRef intHrs As Integer, ByRef decPayHr As Decimal)

Dim decPay As Decimal

decPayHr = decPayHr * 2

lstPay.Items.Add("Pay per hour from sub: " & decPayHr)

decPay = intHrs * decPayHr

lstPay.Items.Add("The pay from sub is: " & decPay)

End Sub

End Class

 

Procbyref2

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

intHrs = CType(txtHrs.Text, Integer)

'intHrs = CInt(txtHrs.Text)

decPayHr = CType(txtPayHr.Text, Decimal)

'decPayHr = Convert.ToDecimal(txtPayHr.Text)

'decPayHr = CDec(txtPayHr.Text)

Directions()

CalcPay(intHrs, decPayHr)

lstPay.Items.Add("Pay per hour from click event: " & decPayHr)

lstPay.Items.Add("The pay from click event is: " & intHrs * decPayHr)

End Sub

Sub Directions()

lstPay.Items.Add("Code multiplies hours by pay per hour")

End Sub

Sub CalcPay(ByRef intHrsProc As Integer, ByRef decPayHrProc As Decimal)

Dim decPay As Decimal

decPayHrProc = decPayHrProc * 2

lstPay.Items.Add("Pay per hour from sub: " & decPayHrProc)

decPay = intHrsProc * decPayHrProc

lstPay.Items.Add("The pay from sub is: " & decPay)

End Sub

End Class

 

Func

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

Dim decPay As Decimal

intHrs = CType(txtHrs.Text, Integer)

decPayHr = CType(txtPayHr.Text, Decimal)

decPay = FuncPay(intHrs, decPayHr)

lstPay.Items.Add("The pay is: " & decPay)

End Sub

Function FuncPay(ByVal intHrs As Integer, ByVal decPayHr As Decimal) As Decimal

Return intHrs * decPayHr

End Function

End Class

 

Funcif

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

Dim decPay As Decimal

intHrs = CType(txtHrs.Text, Integer)

decPayHr = CType(txtPayHr.Text, Decimal)

If intHrs > 40 Then

decPay = FuncOvt(intHrs, decPayHr)

Else

decPay = FuncPay(intHrs, decPayHr)

End If

lstPay.Items.Add("The pay is: " & decPay)

End Sub

Function FuncPay(ByVal intHrs As Integer, ByVal decPayHr As Decimal) As Decimal

Return intHrs * decPayHr

End Function

Function FuncOvt(ByVal intHrs As Integer, ByVal decPayHr As Decimal) As Decimal

Dim ovtPay As Decimal

ovtPay = (intHrs - 40) * decPayHr * 1.5

Return decPayHr * 40 + ovtPay

End Function

End Class

 

Funcif1

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

Dim decPay As Decimal

intHrs = CType(txtHrs.Text, Integer)

decPayHr = CType(txtPayHr.Text, Decimal)

If intHrs > 40 Then

decPay = FuncOvt(intHrs, decPayHr)

Else

decPay = FuncPay(intHrs, decPayHr)

End If

lstPay.Items.Add("The pay is: " & decPay)

End Sub

Function FuncPay(ByVal intHrs As Integer, ByVal decPayHr As Decimal) As Decimal

Return intHrs * decPayHr

End Function

Function FuncOvt(ByVal intHrs As Integer, ByVal decPayHr As Decimal) As Decimal

Dim ovtPay As Decimal, totPay As Decimal

ovtPay = (intHrs - 40) * decPayHr * 1.5

totPay = decPayHr * 40 + ovtPay

Return totPay

End Function

End Class

 

Funcif2

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

Dim decPay As Decimal

intHrs = CType(txtHrs.Text, Integer)

decPayHr = CType(txtPayHr.Text, Decimal)

decPay = FuncPay(intHrs, decPayHr)

lstPay.Items.Add("The pay is: " & decPay)

End Sub

Function FuncPay(ByVal intHrs As Integer, ByVal decPayHr As Decimal) As Decimal

If intHrs > 40 Then

Return decPayHr * 40 + (intHrs - 40) * decPayHr * 1.5

End If

Return intHrs * decPayHr

End Function

End Class

 

Funcbyref

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

Dim decPay As Decimal

intHrs = CType(txtHrs.Text, Integer)

decPayHr = CType(txtPayHr.Text, Decimal)

If intHrs > 40 Then

decPay = FuncOvt(intHrs, decPayHr)

Else

decPay = FuncPay(intHrs, decPayHr)

End If

lstPay.Items.Add("The pay is: " & decPay)

lstPay.Items.Add("The pay per hour is: " & decPayHr)

End Sub

Function FuncPay(ByRef intHrs As Integer, ByRef decPayHr As Decimal) As Decimal

decPayHr = decPayHr + 10

Return intHrs * decPayHr

End Function

Function FuncOvt(ByRef intHrs As Integer, ByRef decPayHr As Decimal) As Decimal

Dim ovtPay As Decimal, totPay As Decimal

ovtPay = (intHrs - 40) * decPayHr * 1.5

totPay = decPayHr * 40 + ovtPay

Return totPay

End Function

End Class

 

Funcbyval

 

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click

Dim intHrs As Integer

Dim decPayHr As Decimal

Dim decPay As Decimal

intHrs = CType(txtHrs.Text, Integer)

decPayHr = CType(txtPayHr.Text, Decimal)

If intHrs > 40 Then

decPay = FuncOvt(intHrs, decPayHr)

Else

decPay = FuncPay(intHrs, decPayHr)

End If

lstPay.Items.Add("The pay is: " & decPay)

lstPay.Items.Add("The pay per hour is: " & decPayHr)

End Sub

Function FuncPay(ByVal intHrs As Integer, ByVal decPayHr As Decimal) As Decimal

decPayHr = decPayHr + 10

Return intHrs * decPayHr

End Function

Function FuncOvt(ByVal intHrs As Integer, ByVal decPayHr As Decimal) As Decimal

Dim ovtPay As Decimal, totPay As Decimal

ovtPay = (intHrs - 40) * decPayHr * 1.5

totPay = decPayHr * 40 + ovtPay

Return totPay

End Function

End Class