Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27353

VS 2012 Datagridview question about changing cells values

$
0
0
I have a button that will give a 15% discount to each line item in a datagridview - Off the "TotalPrice" Column.

The problem is when I press the button in the beginning of the transaction, it just keeps adding the discount to the first line item until the price reaches Zero.

If I click the button at the end of the transaction, once everything is rung up, then it works fine and applys the discount to each line item


Here My code:

Code:

If isMember = True Then
                        MsgBox("Member Found")



                        For Each DGVRow As DataGridViewRow In TransactionsScreen.ItemGridView.Rows
                            Dim DiscountPrice As Decimal
                            Dim TotalPriceBefore As Decimal = DGVRow.Cells("TotalPrice").Value

                            DiscountPrice = TotalPriceBefore - (0.15 * TotalPriceBefore)


                            DGVRow.Cells("TotalPrice").Value = DiscountPrice
                            Exit For
                        Next
                    Else
                        MsgBox("Member Not Added")
                    End If


Viewing all articles
Browse latest Browse all 27353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>