dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Help with Random number and text Box

  1. #1
    Join Date
    Jun 2006
    Posts
    69

    Help with Random number and textBoxes (please)

    I have created a program that gives me six random number but want them to show up in a text box instead they pop up in a little box can anyone give me some advice.
    example if they hit command number one for the first random number the number would show in a text box Second random number show up in a different texbox ect.
    Last edited by cmvw; 06-26-2006 at 08:53 PM.

  2. #2
    Join Date
    Feb 2004
    Location
    Sydney, Australia
    Posts
    498
    'instead they pop up in a little box ' ....

    Can you post a little code?

    Greg

    Have just checked your Previous Post and it seems that this question of yours belongs with that one.
    Last edited by gupex; 06-27-2006 at 08:21 AM.

  3. #3
    Join Date
    Jun 2006
    Posts
    69
    this is what i have for code.
    Private Sub Randomizer()
    Randomize
    lblnum1 = ((54 + 1 = 1) * Rnd + 1)
    lblnum2 = ((54 - 1 + 1) * Rnd + 1)
    lblnum3 = ((54 - 1 + 1) * Rnd + 1)
    lblnum4 = ((54 - 1 + 1) * Rnd + 1)
    lblnum5 = ((54 - 1 + 1) * Rnd + 1)
    lblnum6 = ((54 - 1 + 1) * Rnd + 1)
    MsgBox lblnum1
    MsgBox lblnum2
    MsgBox lblnum3
    MsgBox lblnum4
    MsgBox lblnum5
    MsgBox lblnum6

    End Sub


    Private Sub cmdrand1_Click()
    Randomizer

    End Sub
    thare are 6 cmdrand.
    I am not sure how to get the random number in to the text box instead of it poping up in a dialog box.

  4. #4
    Join Date
    Jun 2006
    Posts
    168
    hi.
    do you mean just like this?



    textbox.text = ((54 + 1 = 1) * Rnd + 1)
    textbox2.text = ((54 - 1 + 1) * Rnd + 1)

    ...etc

    ok wait. so you have 6 command buttons. and each one generates 6 random numbers?

    what are you using the lblnum* variables for?
    -Jon


    Visual Basic 6.0
    Microsoft Access 2003

  5. #5
    Join Date
    Jun 2006
    Posts
    69
    the lblnum associates to each command button.
    what I want it to do give the number in a text box instaed of a popup but when ever I try to put it there it tells me variabe not defined.

  6. #6
    Join Date
    Jun 2006
    Posts
    69
    Thanks I got it aprreciate the assistance.

  7. #7
    Join Date
    Jun 2006
    Posts
    168
    Quote Originally Posted by cmvw
    Thanks I got it aprreciate the assistance.
    what ended up being the problem?
    -Jon


    Visual Basic 6.0
    Microsoft Access 2003

  8. #8
    Join Date
    Jun 2006
    Posts
    69
    it wanted a different name for the textbox why I not sure but once I change it it work fine. The quircks of programming I guess.

Similar Threads

  1. Replies: 4
    Last Post: 11-28-2005, 03:14 PM
  2. TEXT BOX STUFF
    By NEV in forum Web
    Replies: 1
    Last Post: 09-06-2001, 10:23 AM
  3. The number of lines in an HTML text box.
    By Mohamed Abu Zur in forum Java
    Replies: 1
    Last Post: 09-29-2000, 11:41 AM
  4. Replies: 2
    Last Post: 05-18-2000, 04:08 AM
  5. Text box text manipulation
    By Chris in forum VB Classic
    Replies: 2
    Last Post: 03-31-2000, 12:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center