Results 1 to 3 of 3

Thread: double question [Resolved]

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    double question [Resolved]

    I have the following code:
    VB Code:
    1. Private Sub cmdPoints_Click()
    2. Dim x As Double
    3.  
    4.     x = 0
    5.     For i = 0 To 10
    6.         lblconc(i).Caption = 1 - x
    7.         x = x + 0.1
    8.     Next
    9.    
    10. End Sub

    That works fine until it gets to the last one, which should output "0". However it outputs some huge value like "23024625".

    Can someone tell me why? 1-1 should be 0! Is this a problem with the caption of a label?
    Last edited by ober0330; Feb 10th, 2004 at 10:53 AM.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    Fanatic Member Graff's Avatar
    Join Date
    Jan 2002
    Location
    Calgary
    Posts
    668
    It's the way your displaying it

    try lblconc(i).caption = Format(1 - x, "0.0")
    If wishes were fishes we'd all cast nets.

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    I figured so. Thanks.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

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