These examples are in the loopscont PowerPoint

 

Runningtotal project

 

Public Class frmRunningTotal

    Inherits System.Windows.Forms.Form

 

    Private Sub btnEntry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEntry.Click

        btnEntry.Visible = False

        Dim wkInput As Decimal = 0

        Dim wkTotal As Decimal = 0

        Dim ct As Integer = 0

        Do While ct < CInt(txtNumEntries.Text)

            wkInput = InputBox("Enter the amount of the check", "Checks")

            wkTotal = wkTotal + wkInput

            ct = ct + 1

            txtRunningTotal.Text = FormatCurrency(wkTotal)

        Loop

    End Sub

   

    Private Sub txtNumEntries_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtNumEntries.Leave

        If IsNumeric(txtNumEntries.Text) And Val(txtNumEntries.Text) > 0 Then

            lblNumEntries.Visible = False

            txtNumEntries.Visible = False

            btnEntry.Visible = True

        Else

            MsgBox("Please enter number of entries", MsgBoxStyle.OKOnly, "Important")

            txtNumEntries.Focus()

        End If

    End Sub

 

    Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click

        End

    End Sub

End Class

 

Runningtotalsfor project

 

Public Class frmRunningTotalFor

    Inherits System.Windows.Forms.Form

 

    Private Sub btnEntry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEntry.Click

        btnEntry.Visible = False

        Dim wkInput As Decimal = 0

        Dim wkTotal As Decimal = 0

        Dim ct As Integer = 0

        For ct = 1 To CInt(txtNumEntries.Text)

            wkInput = InputBox("Enter the amount of the check", "Checks")

            wkTotal = wkTotal + wkInput

            txtRunningTotal.Text = FormatCurrency(wkTotal)

        Next ct

    End Sub

 

    Private Sub txtNumEntries_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtNumEntries.Leave

        If IsNumeric(txtNumEntries.Text) And Val(txtNumEntries.Text) > 0 Then

            lblNumEntries.Visible = False

            txtNumEntries.Visible = False

            btnEntry.Visible = True

        Else

            MsgBox("Please enter number of entries", MsgBoxStyle.OKOnly, "Important")

            txtNumEntries.Focus()

        End If

    End Sub

 

    Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click

        End

    End Sub

End Class

 

Loopstotallist project

 

Public Class frmRunningTotList

    Inherits System.Windows.Forms.Form

 

    Private Sub btnEntry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEntry.Click

        btnEntry.Visible = False

        Dim wkInput As Decimal = 0

        Dim wkTotal As Decimal = 0

        Dim ct As Integer = 0

        Do While ct < CInt(txtNumEntries.Text)

            wkInput = InputBox("Enter the amount of the check", "Checks")

            wkTotal = wkTotal + wkInput

            ct = ct + 1

            lstAmounts.Items.Add(FormatCurrency(wkInput))

            txtRunningTotal.Text = FormatCurrency(wkTotal)

        Loop

    End Sub

 

    Private Sub txtNumEntries_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtNumEntries.Leave

        If IsNumeric(txtNumEntries.Text) And Val(txtNumEntries.Text) > 0 Then

            lblNumEntries.Visible = False

            txtNumEntries.Visible = False

            btnEntry.Visible = True

        Else

            MsgBox("Please enter number of entries", MsgBoxStyle.OKOnly, "Important")

            txtNumEntries.Focus()

        End If

    End Sub

 

    Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click

        End

    End Sub

End Class