Results 1 to 4 of 4

Thread: textbox question and Random question........

  1. #1

    Thread Starter
    Addicted Member Smie's Avatar
    Join Date
    Jun 1999
    Location
    Columbus, OH
    Posts
    249

    Question

    first, if possible, how would i make a textbox scrollable, but the user cannot edit the text? Enable disables the entire textbox including the scroll, what should i do?

    also, i have this code:

    Random = Int(Rnd * 25)

    now, i have 25 different command buttons, i want, when random selects a command, for the program to run the code that is associated with clicking the button.......

    Random = Int(Rnd * 25)
    Command(Random).???????????????

    what should i do? Thanks much for all your help!

  2. #2
    Addicted Member
    Join Date
    Apr 2000
    Location
    Sheffield, England.
    Posts
    136
    1. Set the TextBox 'Locked' property to 'True'.

    Not proper code - sort of a flow diagram...:-

    If RandomNumber=1 then Command1_Click
    If RandomNumber=2 then Command2_Click
    ...and so on...

    ...but with 25 different possibilities, you might be better using Select...Case. Look it up in MSDN.



  3. #3
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Try

    Text1.Locked = True

    and

    Command(Random).Value = True
    Iain, thats with an i by the way!

  4. #4
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    If you have a single command button named Command, for example, you would call its Click event like this:

    Code:
    Command_Click
    If you have a control array -- from your post, it seems to be the case:

    Code:
    Command_Click(Random)
    where Random is your random number. You can then use a Select Case .. End Select statement block to take action inside the button array's event handler.

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