I am trying to write a program in Visual Basic (the program is the game of blackjack, to be precise), and am having trouble finding a way to code the program so that once a card is removed from the deck, it will not reappear until the next shuffle. I downloaded a tutorial that suggested using collections to do this… I have only just started learning Visual Basic and have had no exposure with collections until now.
The tutorial I downloaded gave the following example of using collections to randomize a list of items, and then selecting them, making sure there are no repeats. In this example, there are 6 names, instead of a deck of cards being used.
The program halts once it gets to that last line of code, and says:
… whilst highlingting “Rand” as the culprit.
What’s the problem?
I am still only in the beginner’s learning phase of Visual Basic, so please keep any responses as lay as possible ;).
Is the code actually running in a Form, or is it somewhere else (like a class or module)?
The Me object is only available to code that is defined in a Form, not elsewhere (well…it’s available in classes, which Forms sorta are, but let’s not muddy the issue). “Me.Cls” should be valid for any code running in a Form.