DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Random code

  1. #1
    Join Date
    Jan 2006
    Posts
    7

    Exclamation Random code

    how do you make objects cycle randomly on a form

    like...

    dim ___ as double
    randomize


    and i dont know the rest

    ~aztek

  2. #2
    Join Date
    Oct 2005
    Location
    Staffordshire, England
    Posts
    101
    Quote Originally Posted by xaztekx
    how do you make objects cycle randomly on a form
    So you want to show objects/controls randomly on the Form?
    I've been programming with VB for 15 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

    Martin2k

  3. #3
    Join Date
    Feb 2005
    Posts
    103
    You could try:

    Dim R As Long
    Randomize
    R& = Rnd * 4 'This will randomly select between 5 objects
    Select Case R&
    Case 0
    'Object 1 (Example: txtBox.Visible = True)
    Case 1
    'Object 2 (Example: txtBox.Visible = True)
    Case 2
    'Object 3 (Example: txtBox.Visible = True)
    Case 3
    'Object 4 (Example: txtBox.Visible = True)
    Case 4
    'Object 5 (Example: txtBox.Visible = True)
    End Select

Similar Threads

  1. Control Arrays in VB.NET
    By Gary Nelson in forum .NET
    Replies: 277
    Last Post: 10-01-2003, 12:00 AM
  2. .NET equals Efficiency
    By Kevin in forum .NET
    Replies: 150
    Last Post: 03-04-2002, 06:40 PM
  3. Replies: 3
    Last Post: 07-09-2001, 03:25 PM
  4. Another Language
    By Steven Bell in forum .NET
    Replies: 260
    Last Post: 06-01-2001, 04:32 PM
  5. Replies: 90
    Last Post: 04-17-2001, 12:45 AM

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