Results 1 to 2 of 2

Checking for invalid scores

Threaded View

  1. #1
    Registered User
    Join Date
    01-20-2007
    Posts
    15

    Checking for invalid scores

    I have a scoreboard function that I'm working on and there will need to be a lot of indepth (for me) code to weed out impossible/invalid scores

    Here is the code as it stands without any of my failed attempts at error checking.

    Private Sub scoreInput_Click()
        Dim score As Integer
        Dim scored As Integer
        Dim thrown As Integer
        
        thrown = dartsThrown.Caption
        score = Label1.Caption
        scored = TextBox1
        
        Select Case scored
            Case 60 To 99
                sixtyplus.Caption = sixtyplus + 1
            Case 100 To 139
                tonplus.Caption = tonplus + 1
            Case 140 To 179
                t40.Caption = t40 + 1
            Case 180
                t80.Caption = t80 + 1
        End Select
            
        dartsThrown.Caption = thrown + 3
        Label1.Caption = (score - scored)
        TextBox1.Text = ""
        TextBox1.Activate
        
        If Label1.Caption = 0 Then
            Call submitLeg_Click
        End If
        
    End Sub
    Impossible scores: Less than 0, 163, 166, 169, 172, 173, 175, 177, 178, 179, 181 and above.

    Impossible scores to end a game with (that results in 'score' going to zero): 159, 162, 163, 165, 166, 168, 169, 171 and above.

    Score remaining: Any 'scored' value that results in 'score' being less than zero has to stop everything. I've made several attempts at this that are logical to me but still seem to subtract the score anyway.
    Last edited by KJC; 04-04-2013 at 12:55 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1