Rounding numbers in VB6

Sharky Forums


Results 1 to 7 of 7

Thread: Rounding numbers in VB6

Threaded View

  1. #1
    Goldfish daftness101's Avatar
    Join Date
    Jun 2002
    Location
    Fresno, CA, US, NW Hemisphere, Earth, Milky Way
    Posts
    52

    Question Rounding numbers in VB6

    Hello. I'm having trouble with a program that I have to write for my computer concepts class that's due next month, when we actually cover VB. I'm not asking anyone to do my homework for me, since I've got everything I need done. The program does what it's supposed to do, but I can't figure out how to make the currency display in the textbox with only 2 numbers after the decimal instead of 4. Anyone have a good idea on how to do this?

    Here's what I have which is working fine:
    Code:
    Private Sub cmdCalculate_Click()
        Dim cBillAmt@, cTipAmt@
        Dim sPercent!
        
        cBillAmt@ = CCur(txtAmount.Text)
        sPercent! = CSng(txtPercentage.Text)
        cTipAmt@ = cBillAmt@ * sPercent!
        txtTipAmt.Text = "$" & CStr(cTipAmt@)
    End Sub
    Thanks in advance.

    -Daft
    Last edited by daftness101; 07-04-2002 at 03:24 PM.

Posting Permissions

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