Results 1 to 3 of 3

Thread: random number

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Dullawhere
    Posts
    100

    Question

    if i want to display a random number from 1-999 (including 1 and 999)(no decimals) then what should i do?\

    Help Is Appreciated

  2. #2
    Addicted Member Michael Woolsey's Avatar
    Join Date
    Nov 2000
    Location
    Calgary, Alberta, Canada.
    Posts
    243
    I put this code in a new project, its also assuming you have a text box named Text1.

    Code:
    Private Sub Form_Load()
      Randomize
      Text1.Text = Int((999 * Rnd) + 1)
    End Sub
    Hope this helps.
    Michael
    Application/Web Developer

    Visual Basic 6.0 SP5
    Active Server Pages
    Oracle 9i
    - I'm going to live forever, or die trying!

  3. #3
    Guest
    Code:
    Randomize
    MsgBox Int(Rnd * 999) + 1

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