Procbyval Project (Procfunc PowerPoint)

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

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 Project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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 Project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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 Project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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 Project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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 project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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 project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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 project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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 project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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

 

Funcbyval project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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

 

Funcbyref project

 

Public Class FrmProc

    Inherits System.Windows.Forms.Form

 

    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

FuncinVB Project

 

Public Class frmFuncConvert

    Inherits System.Windows.Forms.Form

 

    Private Sub btnAdr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdr.Click

        Dim wkCSZ As String, wkComma As Integer, wkCityLen As Integer

        Dim wkLen As Integer, wkState As Integer

        wkCSZ = InputBox("Enter City followed by a comma and space then State space Zip", "Address")

        wkComma = InStr(wkCSZ, ",")

        wkLen = wkCSZ.Length

        wkCityLen = wkComma - 1

        txtCity.Text = wkCSZ.Substring(0, wkCityLen)

        txtCity1.Text = Microsoft.VisualBasic.Left(wkCSZ, wkCityLen)

        txtState.Text = wkCSZ.Substring(wkComma + 1, 2)

        wkState = wkComma + 2

        txtState1.Text = Microsoft.VisualBasic.Mid(wkCSZ, wkState, 2)

        txtZip.Text = wkCSZ.Substring(wkLen - 5, 5)

        txtZip1.Text = Microsoft.VisualBasic.Right(wkCSZ, 5)

 

 

 

    End Sub

End Class