2012-01-30 57 views
0

我有3列数量,价格和金额,我需要使用DataGridView计算每行的金额,我可能会使用哪些可能的事件?如何使用DataGridView计算单元格

+0

地铁?的WinForms? WPF? Silverlight的? ASP.Net? MonoTouch的? – SLaks 2012-01-30 02:09:14

+0

WinForms Sir :) – Dennis 2012-01-30 02:14:33

回答

1

我认为数量是Cell 0,价格为Cell 1,并且量Cell 2

For i As Integer = 0 To DataGridView1.RowCount - 1 
    Dim xQty as Double = CDBL(DataGridView1.Rows(i).Cells(0).Value) 
    Dim xPrc as Double = CDBL(DataGridView1.Rows(i).Cells(1).Value) 
    DataGridView1.Rows(i).Cells(2).Value = xQty * xPrc 
Next