I have a couple quick questions with the program that I am doing. This program is a hi\lo program and here are my remaining issues...

1. When I click the high or low button in my program it does not make changes to my token (I want the default tokens to be 100 and added 100 to the text property of my textbox so want to make sure I did that right)

2. In my program it only shows 13 possibilities but want to have the ability to add more

3. I also would like to change 1 to ace, 11 to jack, 12 to queen, and 13 to king and would like to get some assistance with that as well

I think I have everything else taken care of but this is the code I have...

Public Class Form1

    Private randomgen As New Random
    Private cards As Integer
    Private cardpicked As Object
    Private clicked As Integer = 1
    Private used1, used2, used3, used4, used5, used6, used7, used8, used9, used10 As Integer
    Private myList As New List(Of Integer)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        For index As Integer = 1 To 13

            myList.Add(index)

        Next

        ShuffleCards(1000)

    End Sub

    Private Sub ShuffleCards(ByVal NumberOfTimes As Integer)

        Dim listIndex As Integer
        Dim output As String = ""
        Dim currentCard As Integer

        Try

            For index As Integer = 1 To NumberOfTimes
                listIndex = randomgen.Next(1, 14) - 1

                'Get a currentCard
                currentCard = myList.Item(listIndex)

                'Remove it at a RANDOM position.
                myList.RemoveAt(listIndex)

                'Add it back to the list at the end of the list.
                myList.Add(currentCard)

            Next

            For cardNumber As Integer = 1 To 13
                output &= myList(cardNumber - 1) & ControlChars.NewLine

            Next

        Catch

        End Try

        MessageBox.Show("Card Order is now" & ControlChars.NewLine & output)

    End Sub

    Private Sub PickCard()

        Dim cardNumber As Integer
        If myList.Count > 0 Then

            cardNumber = myList.Item(0)
            myList.RemoveAt(0)

        ElseIf myList.Count = 0 Then

            MessageBox.Show("No more cards left sorry!!")

            Exit Sub

        End If

        MessageBox.Show("CardNumber is now " & cardNumber)

        clicked = clicked + 1

    End Sub



    Private Sub cardCheckButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cardCheckButton.Click

        PickCard()

    End Sub


    Private Sub highButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles highButton.Click
        '  Dim cardNumber As Integer
        'If cardNumber >> cardpicked Then
        'tokensTextBox = 100 + 10

        'ElseIf cardNumber << cardpicked Then
        'tokensTextBox = 100 - 10

        'End If

    End Sub

    Private Sub tokensTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tokensTextBox.TextChanged
        'START WITH 100 TOKENS

    End Sub

    Private Sub lowButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lowButton.Click
        'Dim cardNumber As Integer
        'If cardNumber >> cardpicked Then
        '   tokensTextBox = tokensTextBox - 10

        'ElseIf cardNumber << cardpicked Then
        '   tokensTextBox = 100 + 10
    End Sub

    Private Sub quitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles quitButton.Click
        Me.Close()
    End Sub
End Class

still working on my program but these are the updates I have made...

Public Class Form1

    Private randomgen As New Random
    Private cards As Integer
    Private cardpicked As Object
    Private clicked As Integer = 1
    Private used1, used2, used3, used4, used5, used6, used7, used8, used9, used10 As Integer
    Private myList As New List(Of Integer)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        For index As Integer = 1 To 13

            myList.Add(index)

        Next

        ShuffleCards(1000)

    End Sub

    Private Sub ShuffleCards(ByVal NumberOfTimes As Integer)

        Dim listIndex As Integer
        Dim output As String = ""
        Dim currentCard As Integer

        Try

            For index As Integer = 1 To NumberOfTimes
                listIndex = randomgen.Next(1, 14) - 1

                'Get a currentCard
                currentCard = myList.Item(listIndex)

                'Remove it at a RANDOM position.
                myList.RemoveAt(listIndex)

                'Add it back to the list at the end of the list.
                myList.Add(currentCard)

            Next

            For cardNumber As Integer = 1 To 13
                output &= myList(cardNumber - 1) & ControlChars.NewLine

            Next

        Catch

        End Try

        MessageBox.Show("Card Order is now" & ControlChars.NewLine & output)

    End Sub

    Private Sub PickCard()

        Dim cardNumber As Integer
        If myList.Count > 0 Then

            cardNumber = myList.Item(0)
            myList.RemoveAt(0)

        ElseIf myList.Count = 0 Then

            MessageBox.Show("No more cards left sorry!!")

            Exit Sub

        End If

        'BEFORE OPENING THE PROGRAM THIS SHOWS THE ORDER OF THE CARDS
        MessageBox.Show("CardNumber is now " & cardNumber)

        clicked = clicked + 1

    End Sub



    Private Sub cardCheckButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cardCheckButton.Click

        PickCard()

    End Sub


    Private Sub highButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles highButton.Click
        Dim cardNumber As Integer
        If cardNumber > cardpicked Then
            tokensTextBox.Text = tokensTextBox.Text + tokensToBetTextBox.Text

        ElseIf cardNumber < cardpicked Then
            tokensTextBox.Text = tokensTextBox.Text - tokensToBetTextBox.Text

        End If

    End Sub

    Private Sub tokensTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tokensTextBox.TextChanged
        'START WITH 100 TOKENS

    End Sub

    Private Sub lowButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lowButton.Click
        Dim cardNumber As Integer
        If cardNumber > cardpicked Then
            tokensTextBox.Text = tokensTextBox.Text - tokensToBetTextBox.Text

        ElseIf cardNumber < cardpicked Then
            tokensTextBox.Text = tokensTextBox.Text + tokensToBetTextBox.Text

        End If
    End Sub

    Private Sub quitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles quitButton.Click
        Me.Close()
    End Sub

    Private Sub QuitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub tokensToBetTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tokensToBetTextBox.TextChanged
        If Val(tokensToBetTextBox.Text) < 10 Then
            tokensToBetTextBox.Text = Val(tokensToBetTextBox.Text)
        End If
    End Sub
End Class

anyone have any idea on this

Member Avatar for Unhnd_Exception

I changed a couple of things.

You need 3 Buttons: btnHi, btnLow, btnPlayAgain.
2 Labels: lblTokens, lblCardShown
1 TextBox: txtBet

See if this will work for you.

Public Class Form1

    Private Deck As New List(Of Cards)
    Private CardShown As Cards
    Private NextCard As Cards

    Private Tokens As Integer
    Private Bet As Integer

    Private Enum Cards
        None = 0
        Ace
        _2
        _3
        _4
        _5
        _6
        _7
        _8
        _9
        _10
        Jack
        Queen
        King
        'if you want the ace at the bottom then
        'move it to the bottom and set _2 = 2
    End Enum

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        StartGame()
    End Sub

    Private Sub StartGame()
        Deck.Clear()

        For i = 1 To 4
            For Each card As Cards In [Enum].GetValues(GetType(Cards))
                If card = Cards.None Then Continue For
                Deck.Add(card)
            Next
        Next

        ShuffleCards(1000)

        CardShown = PickCard()
        NextCard = PickCard()

        Tokens = 100

        lblTokens.Text = "Tokens: " & Tokens
        lblCardShown.Text = CardShown.ToString.Replace("_", " ")

    End Sub

    Private Sub ShuffleCards(ByVal NumberOfTimes As Integer)

        Dim listIndex As Integer
        Dim currentCard As Cards

        Randomize()
        For i = 1 To NumberOfTimes
            listIndex = Rnd() * (Deck.Count - 1)
            currentCard = Deck.Item(listIndex)
            Deck.RemoveAt(listIndex)
            Deck.Add(currentCard)
        Next

    End Sub

    Private Function PickCard() As Cards

        If Deck.Count > 0 Then
            Dim thisCard As Cards = Deck.Item(0)
            Deck.RemoveAt(0)
            Return thisCard
        Else
            Return Cards.None
        End If

    End Function

    Private Function CheckBet() As Boolean
        If String.IsNullOrEmpty(txtBet.Text) Then
            MsgBox("Make a bet.")
            Return False
        End If

        If Not IsNumeric(txtBet.Text) Then
            MsgBox("Tokens must be numeric.")
            Return False
        End If

        If CInt(txtBet.Text) < 0 Then
            MsgBox("Bet must be greater or equal to 0.")
            Return False
        End If
        If CInt(txtBet.Text) > Tokens Then
            MsgBox("You don't have enough tokens.")
            Return False
        End If

        Return True

    End Function

    Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHigh.Click, btnLow.Click

        If CheckBet() = False Then Exit Sub

        Dim _CardShown As Integer = CardShown
        Dim _NextCard As Integer = NextCard

        'if btnLow then set the cards to negative so
        'the >= will be reversed.
        If sender.Equals(btnLow) Then
            _CardShown *= -1
            _NextCard *= -1
        End If

        If _NextCard >= _CardShown Then
            Tokens += CInt(txtBet.Text)
        Else
            Tokens -= CInt(txtBet.Text)
        End If

        CardShown = NextCard
        NextCard = PickCard()

        If NextCard = Cards.None Then
            lblCardShown.Text = "No more cards"
        Else
            If Tokens <= 0 Then
                lblTokens.Text = "You lose"
                Deck.Clear()
            Else
                lblTokens.Text = "Tokens " & Tokens
            End If
            lblCardShown.Text = CardShown.ToString.Replace("_", "")
        End If

    End Sub

    Private Sub btnPlayAgain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlayAgain.Click
        StartGame()
    End Sub

End Class

My only problems are after placing a bet and I try clicking higher or lower nothing happens so it doesnt even add the tokens even if it is right or wrong

Public Class Form1

    Private Deck As New List(Of Cards)
    Private CardShown As Cards
    Private NextCard As Cards
    Private Tokens As Integer
    Private Bet As Integer
    Private Enum Cards
        None = 0
        Ace
        _2
        _3
        _4
        _5
        _6
        _7
        _8
        _9
        _10
        Jack
        Queen
        King

      End Enum

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
        StartGame()

    End Sub

    Private Sub StartGame()

        Deck.Clear()

        For i = 1 To 4
            For Each card As Cards In [Enum].GetValues(GetType(Cards))

                If card = Cards.None Then Continue For
                Deck.Add(card)
            Next
        Next

        ShuffleCards(1000)
        CardShown = PickCard()
          NextCard = PickCard()

        Tokens = 100
        tokensLabel.Text = "Tokens: " & Tokens
        cardLabel.Text = CardShown.ToString.Replace("_", " ")

    End Sub

    Private Sub ShuffleCards(ByVal NumberOfTimes As Integer)

        Dim listIndex As Integer
        Dim currentCard As Cards

        Randomize()
        For i = 1 To NumberOfTimes


            listIndex = Rnd() * (Deck.Count - 1)
            currentCard = Deck.Item(listIndex)
            Deck.RemoveAt(listIndex)
            Deck.Add(currentCard)
        Next
    End Sub

    Private Function PickCard() As Cards
        If Deck.Count > 0 Then
            Dim thisCard As Cards = Deck.Item(0)
            Deck.RemoveAt(0)
            Return (thisCard)
        Else
            Return (Cards.None)
        End If
    End Function

    Private Function CheckBet() As Boolean
        If String.IsNullOrEmpty(tokensToBetTextBox.Text) Then
            MsgBox("Make a bet.")
            Return (False)
        End If

        If Not IsNumeric(tokensToBetTextBox.Text) Then
            MsgBox("Tokens must be numeric.")
            Return (False)
        End If

        If CInt(tokensToBetTextBox.Text) < 0 Then
            MsgBox("Bet must be greater or equal to 0.")
            Return (False)
        End If

        If CInt(tokensToBetTextBox.Text) > Tokens Then
            MsgBox("You don't have enough tokens.")
            Return (False)
        End If

        Return (True)
    End Function

    Private Sub cardCheckButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If CheckBet() = False Then Exit Sub
        Dim _CardShown As Integer = CardShown
        Dim _NextCard As Integer = NextCard

        If sender.Equals(lowButton) Then
            CardShown *= -1
            NextCard *= -1
        End If

        If _NextCard >= _CardShown Then

            Tokens += CInt(tokensToBetTextBox.Text)
        Else

            Tokens -= CInt(tokensToBetTextBox.Text)
        End If

        CardShown = NextCard
        NextCard = PickCard()
        If NextCard = Cards.None Then
            cardLabel.Text = "No more cards"
        Else

            If Tokens <= 0 Then
                tokensLabel.Text = "You lose"
                Deck.Clear()
            Else
                tokensLabel.Text = "Tokens " & Tokens
            End If
            cardLabel.Text = CardShown.ToString.Replace("_", "")
        End If
    End Sub

    Private Sub playAgainButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles playAgainButton.Click
        StartGame()

    End Sub

End Class
Member Avatar for Unhnd_Exception
Private Sub cardCheckButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

should have a handles clause on it:
Handles btnHi.click, btnLow.click

Just like the 1 I posted.

Member Avatar for Unhnd_Exception

It looks like you changed the btnlow to lowbutton and I'm assuming you changed the btnHigh to high button.

Private Sub cardCheckButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lowbutton.click, highbutton.click
commented: Great Help +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.