Class Library for Shuffling a deck of cards

  • 14 years ago

    Hi  all,

    I am looking for sample VB.Net codes for deck of cards. Yes, I am looking for a solution.

    The question:

    " A class modules that will simulate shufling a deck of cards. The class module, when initialized, should create an array to store a deck of 52 playing cards. Create a method named Shuffle to shuffle the deck of cards, as well as another method to deal each card from the deck of cards. The latter method, named DealCard, should deal the next card off the deck. This form should contain a list box that displays each card in the deck after they have been shuffled. Will need a button that, when clicked,will shuffle the deck of cards.

    • In the class module, declare an array of structures. This should contain elements, each representing a card in the deck. The structure should have two members: one representing the card (Ace, 2, 3, 4, ...), and a second member representing the suit of the card. In the new procedure, store the cards in the array.
    • To shuffle the cards, all the Randomize function to seed the random number genrator. In random order,copy the content of the first array to a second array.
    • The DealCard method should deal the cards from the second array".

    I am looking for sample codes of deck of cards. Does anyone has codes for this?  I would appreciate it. Thank you.


  • 14 years ago

    Sorry, I don't know of any sample projects to point you to.  You might want to search the internet  for sample projects pertaining to card games such as blackjack, or poker or anything with cards.  Those types of programs are sure to have a shuffling routine.

    If you have any specific questions I'd be happy to help.

  • 14 years ago


    Thanks. I did search many times and I could not find one. I will keep searching.

    Thanks lots,


  • 14 years ago

    Well, I did another quick search and wasn't able to find a very good example either.  Honestly though I think you'd be better off just trying to write the class.  You may not find a helpfull example and even if you do the time wasted finding it could have been better spent writing the code.  Even with mistakes (which are a great learning tool) you'll be better off time wise just sitting down and doing it.  The information on how to go about it is right there in your first post.  Try breaking that information down into parts and figure out what you need to accomplish.  If you don't know how to do something like make a structure just ask or do some research, but the instructions are pretty clear.  Good luck and if you get stuck let me know.  I'll be happy to help.

  • 14 years ago

    Not sure if this will be of any use but

    this is the card game starter kit from msdn


Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Memory is like an orgasm. It's a lot better if you don't have to fake it.” - Seymour Cray