CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Nov 2013
    Posts
    1

    beginner needs help code not working

    Hi everyone I am trying to create an invoice where the form as input and output labels, But when i run it i get no errors but the lables don't output, its obviously the code can anyone help

    Code:
     Private Sub cmdAmountDue_Click(sender As Object, e As EventArgs) Handles cmdAmountDue.Click
            '1.Declare Variables
            Dim strCustomerName As String
            Dim strElectricalItem As String
            Dim decUsualPrice As Decimal
            Dim intUnitsBought As Integer
            Dim intDeliveryDistance As Integer
            Dim decTotalPrice As Decimal
            Dim decReductionAvailable As Decimal
            Dim decPriceAfterReduction As Decimal
            Dim decDeliveryCharge As Decimal
            Dim decAmountDue As Decimal
            Dim decVatAmount As Decimal
            Const decVAT As Decimal = 0.21
    
            '2. Input Values
            strCustomerName = txtCustomerName.Text
            strElectricalItem = txtElectricalItem.Text
            decUsualPrice = txtUsualPrice.Text
            intUnitsBought = txtUnitsBought.Text
            intDeliveryDistance = txtDeliveryDistance.Text
    
    
            '3. Calculate Total Price
            decTotalPrice = intUnitsBought * decUsualPrice
    
            '4. calculate reduction Available
            decReductionAvailable = Val(lblReductionAvailable.Text)
            Select Case decUsualPrice
                Case 0 To 200
                    decReductionAvailable = decUsualPrice * 0.2
                Case 201 To 400
                    decReductionAvailable = decUsualPrice * 0.25
                Case Is > 400
                    decReductionAvailable = decUsualPrice * 0.3
            End Select
    
            ' 5 Calculate Price after Reduction
            decPriceAfterReduction = decTotalPrice - decReductionAvailable
    
            decVatAmount = decPriceAfterReduction * decVAT
            decAmountDue = decPriceAfterReduction + decVatAmount
    
            If intDeliveryDistance <= 20 Then
                decDeliveryCharge = 2.0
            ElseIf intDeliveryDistance > 20 Then
                decDeliveryCharge = 2.5
            End If
    
            decTotalPrice = FormatCurrency(lblTotalPrice, 2)
            decReductionAvailable = FormatCurrency(lblReductionAvailable, 2)
            decPriceAfterReduction = FormatCurrency(lblPriceAfterReduction, 2)
            decVatAmount = FormatCurrency(lblVAT, 2)
            decDeliveryCharge = FormatCurrency(lblDeliveryCharge, 2)
            decAmountDue = FormatCurrency(lblAmountDue, 2)
    Last edited by HanneSThEGreaT; November 18th, 2013 at 10:38 AM. Reason: added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured