Results 1 to 6 of 6

Thread: [RESOLVED] Label caption problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    19

    Resolved [RESOLVED] Label caption problem

    I have a label: lblvat

    When the price changes in other labels on the form, the lblvat.caption changes to display the VAT price.

    But it keeps displaying it to 3 decimal places, despite me changing the dataformat property to currency with 2 decimal places.

    Can anyone help?
    Thanks

  2. #2

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    19

    Re: Label caption problem

    I'm not sure what to put in the "some_new_value" part.

    At the moment the lblvat.caption is created by this code

    VB Code:
    1. Private Sub CalcPrice()
    2. Dim BracPrice As Currency
    3. Dim AdjPrice As Currency
    4. Dim PolPrice As Currency
    5. Dim SwingPrice As Currency
    6.  
    7.  
    8.  
    9. PolPrice = lblPolishing.Caption
    10. BracPrice = lblBracprice.Caption
    11. AdjPrice = lbladjprice.Caption
    12. SwingPrice = lblswingarm.Caption
    13.  
    14.  
    15.  
    16.  
    17. lbltotal.Caption = BracPrice + AdjPrice + PolPrice + SwingPrice
    18. lblVAT.Caption = lbltotal.Caption * 0.173506444
    19. End Sub

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: Label caption problem

    Quote Originally Posted by tomothy
    I'm not sure what to put in the "some_new_value" part...
    Tomothy,
    one thing you must understand: most of the time you will get nothing more than sample logic so you will have to figure out how to use it.
    In this case "some_new_value" means "some new result of some calculation that you might have" and therefore you could easily substitute that with your actual value:
    VB Code:
    1. lblVAT.Caption = FormatNumber(lbltotal.Caption * 0.173506444, 2)
    2. 'or use "regular" Format$() function instead but provide format that you need

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    19

    Re: Label caption problem

    Ah, now I understand.

    Works perfectly, thanks.

  6. #6

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