Search code examples
vb.netdatagridviewdatagridviewcolumn

how to compute the value in the cells of a datagridview?


  Subj   Sec FN  LN   MI    05/22/14  05/23/14  05/24/14   05/25/14 05/26/14   P  A   EQ
Comp103 I-A  Ana Lin  G.   (checked)  (checked) (unchecked)(checked) (checked) 4  1   72

To compute the equivalent grade , we use this formula "(4/9*50)+50", four means the number of present. We based the grade to the days of present. And the result should be in the cell for the equivalent grade. We have 19 columns and the equivalent grade is in the 19th column. how can we solve this kind of problem? Can anyone please help us?! please! thank you


Solution

  • Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)  Handles Button1.Click
    Dim Equivalent As Integer = 0
    For a = 0 To DataGridView1.RowCount - 1
        Equivalent = ((DataGridView1.Rows(a).Cells(10).Value.ToString / 9) * 50) + 50
        DataGridView1.Rows(a).Cells(12).Value = Equivalent 
    Next
    End Sub