Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub CalculateAverages()
- Dim DBLtemp As Double = 0
- Dim INTcount As Integer = 0
- Dim DBLtemp1 As Double = 0
- Dim INTcount1 As Integer = 0
- Dim DBLtemp2 As Double = 0
- Dim INTcount2 As Integer = 0
- Dim DBLtemp3 As Double = 0
- Dim INTcount3 As Integer = 0
- Dim DBLtemp4 As Double = 0
- Dim INTcount4 As Integer = 0
- Try
- '---------------
- For Each item In CutColumn
- If Integer.Parse(item.text) > 0 Then
- DBLtemp += Integer.Parse(item.text)
- INTcount += 1
- Else
- flag = True
- End If
- Next
- MainForm.txtboxavg1.Text = DBLtemp / INTcount
- '-----------------
- For Each item In ColourColumn
- If Integer.Parse(item.text) > 0 Then
- DBLtemp1 += Integer.Parse(item.text)
- INTcount1 += 1
- Else
- flag = True
- End If
- Next
- MainForm.txtboxavg2.Text = DBLtemp1 / INTcount1
- '----------------
- For Each item In HighlightsColumn
- If Integer.Parse(item.text) > 0 Then
- DBLtemp2 += Integer.Parse(item.text)
- INTcount2 += 1
- Else
- flag = True
- End If
- Next
- MainForm.txtboxavg3.Text = DBLtemp2 / INTcount2
- '--------------
- For Each item In ExtentionsColumn
- If Integer.Parse(item.text) > 0 Then
- DBLtemp3 += Integer.Parse(item.text)
- INTcount3 += 1
- Else
- flag = True
- End If
- Next
- MainForm.txtboxavg4.Text = DBLtemp3 / INTcount3
- '--------------
- For Each item In UpDoColumn
- If Integer.Parse(item.text) > 0 Then
- DBLtemp4 += Integer.Parse(item.text)
- INTcount4 += 1
- Else
- flag = True
- End If
- Next
- MainForm.txtboxavg5.Text = DBLtemp4 / INTcount4
- '--------------
- Catch ex As Exception
- MsgBox("Please Use numbers inside each service box")
- End Try
- If flag = True Then
- MsgBox("Please enter only positive values.")
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement