AirforceMook
New Member
- Joined
- Sep 5, 2011
- Messages
- 9
Code:
Private Function Get_Card() As card
Dim unique As Boolean
unique = False
Dim thisCard As card
While unique = False
' new card
Set thisCard = New card
Dim foundInLists As Boolean
foundInLists = False
' check against dealer hand
For Each dc In dealerCards
If dc.Number = thisCard.Number And dc.Suit = thisCard.Suit Then
foundInLists = True
End If
Next dc
' check against player hand
For Each pc In playerCards
If pc.Number = thisCard.Number And pc.Suit = thisCard.Suit Then
foundInLists = True
End If
Next pc
unique = Not foundInLists
Wend
Get_Card = thisCard
End Function
For some reason, Get_Card is 'Nothing' and causes the debugger to trip, selecting that line... even though I can do something like:
Code:
dim c as new card
msgbox(c.suit)
... elsewhere in the code without a problem. "Card" is my own class, it simply has a suit and number to represent standard playing cards. It has an initialize function that assigns a random suit and number to the card.