Results 1 to 2 of 2

Thread: Using Check Boxes

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Leeds England
    Posts
    54

    Using Check Boxes

    This may sound simple to most, but its my first encounter with check boxes so i am none the wiser!
    I have been making a poker simulator and i am now at the stage of making the hold buttons.
    Those who dont know poker, there is a time in the game where you get to select cards from your hand and discard them. In thier place there are some new cards dealt.
    I have Sorted out the deal function, so when i click a button 5 random cards are dealt. Now i have 5 check boxes for the holds.
    When these check boxes are clickedi want the card that has been displayed in the corresponding image box to be kept and the rest (unchecked) are replaced b new cards, using te random function. I have tried this and this is what i have so far.
    Under my check boxes i have:
    Private Sub Check1_Click()
    If Check1.Value = 1 Then
    CardFlag1 = True
    End If
    End Sub

    and under the deal button i have:
    Dim CardFlag1
    Dim CardFlag2
    Dim CardFlag3
    Dim CardFlag4
    Dim CardFlag5
    If CardFlag1 = False Then
    CardNames(0) = "hearts 2"
    CardNames(1) = "hearts 3"
    CardNames(2) = "hearts 4"
    CardNames(3) = "hearts 5"
    CardNames(4) = "hearts 6"
    CardNames(5) = "hearts 7"
    CardNames(6) = "hearts 8"
    CardNames(7) = "hearts 9"
    CardNames(8) = "hearts 10"
    CardNames(9) = "hearts Jack"
    CardNames(10) = "hearts Queen"
    CardNames(11) = "hearts King"
    CardNames(12) = "hearts Ace"
    CardNames(13) = "spades 2"
    CardNames(14) = "spades 3"
    CardNames(15) = "spades 4"
    CardNames(16) = "spades 5"
    CardNames(17) = "spades 6"
    CardNames(18) = "spades 7"
    CardNames(19) = "spades 8"
    CardNames(20) = "spades 9"
    CardNames(21) = "spades 10"
    CardNames(22) = "spades Jack"
    CardNames(23) = "spades Queen"
    CardNames(24) = "spades King"
    CardNames(25) = "spades Ace"
    CardNames(26) = "diamonds 2"
    CardNames(27) = "diamonds 3"
    CardNames(28) = "diamonds 4"
    CardNames(29) = "diamonds 5"
    CardNames(30) = "diamonds 6"
    CardNames(31) = "diamonds 7"
    CardNames(32) = "diamonds 8"
    CardNames(33) = "diamonds 9"
    CardNames(34) = "diamonds 10"
    CardNames(35) = "diamonds Jack"
    CardNames(36) = "diamonds Queen"
    CardNames(37) = "diamonds King"
    CardNames(38) = "diamonds Ace"
    CardNames(39) = "clubs 2"
    CardNames(40) = "clubs 3"
    CardNames(41) = "clubs 4"
    CardNames(42) = "clubs 5"
    CardNames(43) = "clubs 6"
    CardNames(44) = "clubs 7"
    CardNames(45) = "clubs 8"
    CardNames(46) = "clubs 9"
    CardNames(47) = "clubs 10"
    CardNames(48) = "clubs Jack"
    CardNames(49) = "clubs Queen"
    CardNames(50) = "clubs King"
    CardNames(51) = "clubs Ace"

    'not quite sure what this randomize function actually does, but it seems to help the program! : )
    Randomize
    'picks a random member of the array and stores it in temp
    Temp = CardNames(Int(Rnd * 51))

    'this loads the picture, the picture is determined by the random array above
    Image1.Picture = LoadPicture("C:\Matt\Cards\" & Temp & ".bmp")
    End If
    and it doesnt work?! help!

  2. #2
    Lively Member d4v3's Avatar
    Join Date
    Nov 2001
    Location
    Leicester, UK
    Posts
    82
    i dont really see whats wrong! not looked at it long. Post the app and maybe i'll have a better idea.

    And randomize is needed before u use RND, else it wont work!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width