简体   繁体   中英

VB.NET - If not Datagridview cell empty

Gradebook - I have 5 cells (Homeworks, Ex1, Ex2, Ex3, FinalExam) to fill in Datagridview, My app works with normal numbers but when the user type "0" in cells Then the grade wont display. (not sum) . Here a sample of my source code:

 Total = Val(HW + Ex1 + Ex2 + Ex3 + FinalEx) / 5
If Not (DataGridView1.Rows(i).Cells(2).Value) = String.Empty And
        (DataGridView1(i).Cells(3).Value) And (DataGridView1(i).Cells(4).Value) And
        (DataGridView1.Rows(i).Cells(5).Value) And (DataGridView1.Rows(i).Cells(6).Value) Then
            If Total >= 90 Then
                DataGridView1(i).Cells(7).Value = "A"

Do you mean then enter all 0's? I only see a grade for averages above 90. Is there more code for between 80 and 90? If they score 100,100,100,100,0 That's 400/5 or 80. Do you have a grade for values under 80?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM