INTRODUCTION TO USING DO LOOPS FROM LESSON 3: USING TOTALS & COUNTS Public Class frmCounts Inherits System.Windows.Forms.Form '---module level variables Dim m_sngGrandTotal As Single = 0 'hold the running total Dim m_intNumItems As Short = 0 'hold the number of items bought Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click '---take item and cost & put them in textbox txtItem.Text = Trim(Mid(lstItems.SelectedItem, 1, 15)) txtCost.Text = Trim(Mid(lstItems.SelectedItem, 16)) txtCost.Text = FormatNumber(txtCost.Text, 2) '---add this cost to the running total m_sngGrandTotal += CSng(txtCost.Text) m_intNumItems += 1 'same as m_intNumItems = m_intNumItems + 1 End Sub Private Sub btnCheckOut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheckOut.Click lblTotalSpent.Text = "You spent " & m_sngGrandTotal & " today. Thanks!" lblNumItems.Text = "You purchased " & m_intNumItems & " items." End Sub End Class