Results 1 to 2 of 2

Thread: random form help

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    1

    Question random form help

    hey people, im making a program similar to the "magic 8 ball" where when you click on the command button for your answer a random form will pop up with your answer. i have 6 forms but i cant get only 1 to come up, just all 6 of them. im very new at this so if its a simple answer then please excuse my ignorance. im using show commands to get them to come up (because thats the only command i know to bring them up) any help would be great! thanks!

  2. #2
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Is the only thing on these forms a message? If so you could just show a messagebox

    VB Code:
    1. msgbox "My sources say yes"

    Which ever way you do it, you will want to use the rnd function, this creates a number between 0 and 1 (not including 1)

    so to get a number between 1 and 6 you would do

    VB Code:
    1. MyRNDNo = (Rnd*6)+1

    When you wanted to choose which form or msgbox you wanted to display you could wither use an array, or use a select case statement:

    VB Code:
    1. Select Case MyRNDNo
    2. Case 1
    3. 'display answer 1
    4. Case 2
    5. 'display answer 2
    6. ~~~
    7. ~~~
    8. End Select

    if you want it to be truly random put this line

    VB Code:
    1. Randomize

    in before you call Rnd
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


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