For loop to rotate through batters on a Baseball Score Card

Spyd3r0us

New member
Joined
Sep 2, 2010
Messages
4
Programming Experience
Beginner
So I am working on a vb.net project for school the class is a 101 class and it has to do with webapp not forms.

So for my project I am working on creating a baseball score card. I have the layout of what I want it to look like. I am now working on getting the rotation of that batters. I have a button that adds the strikes to the form when pressed. What I am trying to do now is have the cell advance to the next player when it is 3 strikes. Here is the code for the subroutine. What is is doing right now is adding the strike1 image to batter one, the strike2 image to batter2 and the strike3 image to batter 3. How can I fix this so it added all three strikes to batter 1 then moves to batter 2?

VB.NET:
Expand Collapse Copy
    Protected Sub StrikeCount()
        'Counts the Stikes and adds the red dots to the inning
        Dim Strike As Integer = 1 'lblStrikeCount.Text + 1
        Dim cr As Integer = 0
        Dim img As New Image
        For inning = 0 To scCols - 1
            For batter = 0 To scRows - 1 'step 2
                If Strike = 3 Then
                    'resets the strike count to 0 for the next batter
                    lblStrikeCount.Text = 0
                    'adds the out to the current batter
                    lblatbat00.Text = lblatbat00.Text + 1
                    ScoreCard(inning, batter) = cr
                    cr = cr + 1
                Else
                    lblStrikeCount.Text = lblStrikeCount.Text + 1
                    img = FindControl("imgstrikes" & ScoreCard(inning, batter))
                    img.ImageUrl = "Images/Strike" & lblStrikeCount.Text & ".jpg"
                End If
            Next
        Next
    End Sub
 
Back
Top