Results 1 to 6 of 6

Thread: Problem with Rnd

  1. #1
    DarioXP
    Guest

    Unhappy Problem with Rnd

    Ok... I want to make an app that shows a random message at startup, so I created a Sub called Greet that has the following code:
    VB Code:
    1. Select Case Int((6 * Rnd) + 1)
    2.     Case 1
    3.     ...
    4.     Case 2
    5.     ...
    6.     Case 3
    7.     ...
    8.     Case 4
    9.     ...
    10.     Case 5
    11.     ...
    12.     End Select

    And when I run the application, a strange thing happen, when I call the Procedure from Form_Load the message displayed is always the same BUT when I run it from a command button Click event the procedure works, I have a random message each time I press the button but not when I load the form.

    If anyone knows why and eventually how to solve it please tell me, 'cuz I'm getting mad with this

    Thanks in advance,
    DarioXP

  2. #2
    Hyperactive Member Ambivalentiowa's Avatar
    Join Date
    Apr 2002
    Location
    Coming soon to a store near you!
    Posts
    375
    Did you remember to put Randomize in the form load section?
    -Show me on the doll where the music touched you.

  3. #3
    DarioXP
    Guest

    Talking Ehr...

    Whops! Randomize?

  4. #4
    DarioXP
    Guest
    What do you mean?

  5. #5
    DarioXP
    Guest
    OH YEAH! It works thank you

  6. #6
    Hyperactive Member Ambivalentiowa's Avatar
    Join Date
    Apr 2002
    Location
    Coming soon to a store near you!
    Posts
    375
    No problemo my funk soul brotha'.
    -Show me on the doll where the music touched you.

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