FROM LESSON 3: USING TOTALS & COUNTS 'Here we use module-level variables to keep a running total of the number of items and grand total as they 'purchase stuff at our store. 'Module-level variables are declared (DIMmed) in the form but before any events. I always put mine just before 'the Windows form generated code region. 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 WINDOWS FORM GENERATED CODE IS IN HERE 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