ต้องการวนค่าในคอลัมน์ของ Datagridview ไปคำนวณเกรดโดยกดจาก radio Button อิงเกณฑ์
แต่ที่ว่าค่าไม่วนให้คิดได้แต่บรรทัดแรก
Private Sub RadioButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.Click
Dim total As Double = dgvPrintgrad.CurrentRow.Cells(8).Value
For i As Integer = 0 To dgvPrintgrad.Rows.Count - 1
If (total >= 80 And total <= 100) Then
dgvPrintgrad.CurrentRow.Cells(9).Value = "A"
ElseIf (total >= 79 And total <= 75) Then
dgvPrintgrad.CurrentRow.Cells(9).Value = "B+"
ElseIf (total >= 74 And total <= 70) Then
dgvPrintgrad.CurrentRow.Cells(9).Value = "B"
ElseIf (total >= 69 And total <= 65) Then
dgvPrintgrad.CurrentRow.Cells(9).Value = "C+"
ElseIf (total >= 64 And total <= 60) Then
dgvPrintgrad.CurrentRow.Cells(9).Value = "C"
ElseIf (total >= 59 And total <= 55) Then
dgvPrintgrad.CurrentRow.Cells(9).Value = "D+"
ElseIf (total >= 54 And total <= 50) Then
dgvPrintgrad.CurrentRow.Cells(9).Value = "D"
ElseIf (total <= 49 And total >= 0) Then
dgvPrintgrad.CurrentRow.Cells(9).Value = "F"
End If
Next
End Sub
Tag : .NET, Ms SQL Server 2008, VB.NET, VS 2010 (.NET 4.x)