当datagrid组合框值的值发生变化时执行过程

时间:2014-04-14 16:41:24

标签: vb.net datagrid

我有一个带有组合框的数据网格。我想在组合框上的值发生变化时执行以下过程:

Dim dblQty As Double
    Dim dblPrice As Double


    For index As Integer = 0 To grdNewInvoice.RowCount - 1

        dblQty = Convert.ToDouble(grdNewInvoice.Rows(index).Cells(1).Value)
        dblPrice = Convert.ToDouble(grdNewInvoice.Rows(index).Cells(2).Value)

        grdNewInvoice.Rows(index).Cells(3).Value = dblPrice * dblQty

    Next

    Dim dblTotal As Double = 0

    For i As Integer = 0 To grdNewInvoice.RowCount - 1
        If grdNewInvoice.Rows(i).Cells(2).Value IsNot "" Then
            dblTotal += CDbl(grdNewInvoice.Rows(i).Cells(3).Value)
        End If
    Next

    lblTotal.Text = dblTotal.ToString("C")

End Sub

我尝试了不同的事件:CellEndEdit,CellContentClick,但没有一个适合我。我可以使用什么事件。

0 个答案:

没有答案