Advertisement
LettuceCookie

WeeklyProject2: JM Sales Ver. 3

Nov 22nd, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Program Name: WK12- Project 2: JM Sales
  2. 'AUTHOR: STONEBONETHONE
  3. 'DATE: 19 November, 2017
  4. 'OVERVIEW: Program calculates user entered sales made by 5 employees, who all have a salesID
  5. 'The ID and total sales of the employee are calculated and displayed in a results textbox (edit)
  6.  
  7. Option Explicit On
  8. Option Infer Off
  9. Option Strict On
  10.  
  11. Public Class Form1
  12.  
  13.     'This is the array for the sales made
  14.    Dim salesMade(4) As Decimal
  15.  
  16.  
  17.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
  18.         salesIDListBox.Items.Add("101")
  19.         salesIDListBox.Items.Add("112")
  20.         salesIDListBox.Items.Add("203")
  21.         salesIDListBox.Items.Add("301")
  22.         salesIDListBox.Items.Add("302")
  23.  
  24.     End Sub
  25.  
  26.     Private Sub addToTotalButton_Click(sender As Object, e As EventArgs) Handles addToTotalButton.Click
  27.  
  28.         Dim sales As Decimal
  29.  
  30.         'This will convert the enter tbox text to decimals
  31.        Decimal.TryParse(enterSalesTextBox.Text, sales)
  32.  
  33.         'This will add to the sales in each array element, correspodning to the listbox indexes
  34.        salesMade(salesIDListBox.SelectedIndex) += sales
  35.  
  36.  
  37.  
  38.     End Sub
  39.  
  40.     Private Sub CreateTheReport(sender As Object, e As EventArgs) Handles createReportButton.Click
  41.         'Convert array elements to strings
  42.  
  43.  
  44.         'This loop cycles through each array element, printing out the elements and items
  45.        For Each element As String In salesMade
  46.             salesTotalTextBox.Text = salesMade(element)
  47.             salesTotalTextBox.Text = salesIDListBox(salesMade) ' something else?
  48.        Next element
  49.  
  50.  
  51.     End Sub
  52.  
  53.  
  54. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement