Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: help with datagrid value changes


Message #1 by Abraham Luna <abe@a...> on Wed, 16 Aug 2000 11:56:09 -0400
i have also mailed this to other lists.

i can't do a couple of things with my datagrid that i need to do.

i have 6 columns.

boughtprice, recon, fees, freight, commission, totalcost

when any of the values in boughtprice, recon, fees, freight, and commission change i need to add them together and come up with
totalcost

this is the code i have for the boughtprice columnstyle:

        'aBoughtPrice
        aBoughtPrice.NullText = "0"
        aBoughtPrice.MappingName = "BoughtPrice"
        aBoughtPrice.HeaderText = "BoughtPrice"
        aBoughtPrice.Format = "C"
        aBoughtPrice.Width = 87
        AddHandler aBoughtPrice.TextBox.Leave, AddressOf cbRecalculate
        InventoryTable.GridColumnStyles.Add(aBoughtPrice)

and this is the code for the cbRecalculate:

    Private Sub cbRecalculate(ByVal sender As Object, ByVal e As EventArgs)
        With AN_DataTable.Rows(DataGrid1.CurrentRowIndex)
            .Item("TotalCost") = CInt(.Item("BoughtPrice")) + CInt(.Item("Recon")) + CInt(.Item("Fees")) + CInt(.Item("Freight")) +
CInt(.Item("Commission"))
        End With
    End Sub

so the weird thing is:

1. its not formatting the numbers as currency ($00.00)
2. when you type a new value in, and leave, it restores the original value and doesnt recalculate

please help


---------
i'm using visual studio .net on windows 2000 pro


  Return to Index