如何计算datagridview单元格中的值?

时间:2014-05-23 01:05:43

标签: vb.net datagridview datagridviewcolumn

  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

为了计算等效等级,我们使用这个公式"(4/9 * 50)+ 50",4表示当前的数量。我们根据现在的等级来定级。并且结果应该在等效等级的单元格中。我们有19列,同等级别在第19列。我们怎样才能解决这类问题呢?有人可以帮助我们吗?!请!谢谢

1 个答案:

答案 0 :(得分:0)

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