DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    Albuquerque
    Posts
    32

    Unhappy create an array of unique numbers vb.net

    i am trying to create an array that consists of 15 random but unique numbers. any help is appreciated. i am using vb.net 2005.

    thanks!
    Last edited by wartech; 08-14-2006 at 10:42 AM.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Which part do you need help with:
    - Declaring a 15-element array?
    - Generating a random number?
    - Ensuring that the number is not already in the array?
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Aug 2006
    Location
    Albuquerque
    Posts
    32
    ensuring that the number is not already in the array.

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    I would probably use a Hashtable (System.Collections namespace). You can use the .Contains method to determine whether a value is already present and the .CopyTo method to copy it to an array when you have 15 unique values.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Aug 2006
    Location
    Albuquerque
    Posts
    32
    thanks phil i will work on this.

Similar Threads

  1. Replies: 1
    Last Post: 05-31-2006, 02:14 AM
  2. Replies: 2
    Last Post: 04-15-2005, 09:06 PM
  3. create a unique id for each row
    By dam in forum Database
    Replies: 1
    Last Post: 12-06-2002, 10:06 AM
  4. Create Access DB in VB.NET
    By Lee Dodd in forum VB Classic
    Replies: 1
    Last Post: 05-16-2002, 02:34 PM
  5. Replies: 3
    Last Post: 08-02-2000, 01:06 AM

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links