Results 1 to 3 of 3

Thread: How to generate only whole numbers?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202

    How to generate only whole numbers?

    Hi, this is what I have:

    Dim i As Single

    Private Sub Command1_Click()
    For i = 1 To 16
    Text1.Text = i * Rnd
    Next
    End Sub


    I get decimal numbers in my text box, how can I limit them to only whole numbers? Thanks

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    VB Code:
    1. Text1.Text = CInt(i * Rnd)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Great White North, ey?
    Posts
    202
    Thanks, that worked

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