Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. Sub CalculateAverages()
  2. Dim DBLtemp As Double = 0
  3. Dim INTcount As Integer = 0
  4. Dim DBLtemp1 As Double = 0
  5. Dim INTcount1 As Integer = 0
  6. Dim DBLtemp2 As Double = 0
  7. Dim INTcount2 As Integer = 0
  8. Dim DBLtemp3 As Double = 0
  9. Dim INTcount3 As Integer = 0
  10. Dim DBLtemp4 As Double = 0
  11. Dim INTcount4 As Integer = 0
  12. Try
  13. '---------------
  14. For Each item In CutColumn
  15. If Integer.Parse(item.text) > 0 Then
  16. DBLtemp += Integer.Parse(item.text)
  17. INTcount += 1
  18. Else
  19. flag = True
  20. End If
  21.  
  22.  
  23. Next
  24.  
  25. MainForm.txtboxavg1.Text = DBLtemp / INTcount
  26. '-----------------
  27.  
  28. For Each item In ColourColumn
  29. If Integer.Parse(item.text) > 0 Then
  30. DBLtemp1 += Integer.Parse(item.text)
  31. INTcount1 += 1
  32. Else
  33. flag = True
  34. End If
  35.  
  36. Next
  37. MainForm.txtboxavg2.Text = DBLtemp1 / INTcount1
  38. '----------------
  39.  
  40. For Each item In HighlightsColumn
  41. If Integer.Parse(item.text) > 0 Then
  42. DBLtemp2 += Integer.Parse(item.text)
  43. INTcount2 += 1
  44. Else
  45. flag = True
  46. End If
  47.  
  48. Next
  49. MainForm.txtboxavg3.Text = DBLtemp2 / INTcount2
  50. '--------------
  51.  
  52. For Each item In ExtentionsColumn
  53. If Integer.Parse(item.text) > 0 Then
  54. DBLtemp3 += Integer.Parse(item.text)
  55. INTcount3 += 1
  56. Else
  57. flag = True
  58. End If
  59.  
  60. Next
  61. MainForm.txtboxavg4.Text = DBLtemp3 / INTcount3
  62. '--------------
  63.  
  64. For Each item In UpDoColumn
  65. If Integer.Parse(item.text) > 0 Then
  66. DBLtemp4 += Integer.Parse(item.text)
  67. INTcount4 += 1
  68. Else
  69. flag = True
  70. End If
  71.  
  72. Next
  73. MainForm.txtboxavg5.Text = DBLtemp4 / INTcount4
  74. '--------------
  75. Catch ex As Exception
  76. MsgBox("Please Use numbers inside each service box")
  77. End Try
  78. If flag = True Then
  79. MsgBox("Please enter only positive values.")
  80. End If
  81. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement