لا ادري ان كنت فمتك بشكل صحيح
هذا الكود يحسب المتوسط لمجموع كل الدرجات
Dim total As Single = 0
For Each pg As TabPage In TabControl1.TabPages
Dim lbl As Label = pg.Controls.OfType(Of Label)().First
Dim tot As Single = 0
For Each tb As TextBox In pg.Controls.OfType(Of TextBox)()
If String.IsNullOrEmpty(tb.Text.Trim) Then
tb.BackColor = Color.Red
Else
tb.BackColor = Color.White
End If
tot += Val(tb.Text)
Next
lbl.Text = tot
total += tot
Next
Dim av = total / TabControl1.TabPages.Count
MsgBox(av)
هذا الكود يحسب المتوسط لمجموع كل الدرجات
Dim total As Single = 0
For Each pg As TabPage In TabControl1.TabPages
Dim lbl As Label = pg.Controls.OfType(Of Label)().First
Dim tot As Single = 0
For Each tb As TextBox In pg.Controls.OfType(Of TextBox)()
If String.IsNullOrEmpty(tb.Text.Trim) Then
tb.BackColor = Color.Red
Else
tb.BackColor = Color.White
End If
tot += Val(tb.Text)
Next
lbl.Text = tot
total += tot
Next
Dim av = total / TabControl1.TabPages.Count
MsgBox(av)
