Scoreboard Help

soar-board106

New member
Joined
Nov 29, 2008
Messages
3
Location
Australia
Programming Experience
Beginner
Hi, I'm new to the forum and I've been looking around the www and still can't find help for this. I have a scoreboard I'm devoloping...

3068907177_e04726fc60.jpg


...with the following code:

VB.NET:
Public Class Form1
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Timer1.Enabled = False
        Command1.Text = "Start"
        Command2.Text = "Pause"
        Label1.Text = "20:00.0"
    End Sub
    Private CountDownStart
    Private Sub Command1_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Command1.Click
        If Not Timer1.Enabled Then
            CountDownStart = Microsoft.VisualBasic.DateAndTime.Timer
            Timer1.Enabled = True
            Command1.Text = "Stop"
            Command2.Text = "Pause"
            Command2.Enabled = True
        Else
            Timer1.Enabled = False
            'MsgBox("Final Time: " & Label1.Text & vbCrLf & vbCrLf & "Click OK to reset the clock.")
            Label1.Text = "20:00.0"
            Command1.Text = "Start"
            Command2.Text = "-----"
            Command2.Enabled = False
        End If
    End Sub
    Private Sub Command2_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Command2.Click
        Static PauseInterval
        If Timer1.Enabled Then
            PauseInterval = Microsoft.VisualBasic.DateAndTime.Timer - CountDownStart
            Timer1.Enabled = False
            Command1.Text = "Restart"
            Command2.Text = "Resume"
        Else
            CountDownStart = Microsoft.VisualBasic.DateAndTime.Timer - PauseInterval
            Timer1.Enabled = True
            Command1.Text = "Stop"
            Command2.Text = "Pause"
        End If
    End Sub
    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim MinDiff
        Dim SecDiff
        Dim TenthDiff
        Dim TimeDiff
        TimeDiff = (12000) - Int((Microsoft.VisualBasic.DateAndTime.Timer - CountDownStart) * 10)
        If TimeDiff >= 0 Then
            TenthDiff = TimeDiff Mod 10
            SecDiff = Int(TimeDiff / 10) Mod 60
            MinDiff = Int(TimeDiff / 600)
            Label1.Text = Format(MinDiff, "00") & ":" & Format(SecDiff, "00") & "." & Format(TenthDiff, "0")
        Else
            Label1.Text = "00:00.0"
            Timer1.Enabled = False
            MsgBox("!!!TIME!!!")
            Command1.Text = "Start"
            Command2.Text = "-----"
            Command2.Enabled = False
        End If
        'Application.DoEvents()
    End Sub
End Class

As you can see from the screen-shot, there are several labels. There is a timer (done), a period marker (the 0 next to the 20:00.0), Home/Away team labels, and 0's representing scores (under 1, 3, 6, 9 and T labels). There are H and A buttons underneath each set of 0's.

The H/A buttons need to increase the Home/Away 1, 3, 6 or 9 column by 1, therefore increasing the score by 1, 3, 6 or 9 (e.g. clicking the H under 9 increase Home Team's 9 column by 1 and Home Team's score by 9).

I have made an Excel spreadsheet to demonstrate what I need.

All help is appreciated.

soar-board

P.S. If I learn how to use int functions I may be able to complete this, so can someone please help with this.
 

Attachments

  • egtoupload.zip
    1.7 KB · Views: 14
Um, you haven't actually asked a question as far as I can tell. I for one will not be downaloding a ZIP file and extracting an Excel spreadsheet when you could simply post a question right here.
 
Oh sorry...

I need to know how to increment each column (1, 3, 6 or 9) by 1, yet increase the score at the same time by 1, 3, 6 or 9. I believe you need to use the int feature but I am not sure exactly how to use it yet. The ZIP contains the excel document (no macros and viruses (to my knowledge)).
 
Um, there is no "int feature". Basically you should be storing all those values in Integer variables:
VB.NET:
Private home1 As Integer = 0
Private home3 As Integer = 0
Private home6 As Integer = 0
Private home9 As Integer = 0
Private homeTotal As Integer = 0
Private away1 As Integer = 0
Private away3 As Integer = 0
Private away6 As Integer = 0
Private away9 As Integer = 0
Private awayTotal As Integer = 0
On each Button Click you then simply increment the appropriate subtotal and display that in the appropriate Label, then update the appropriate total and display that in the appropriate Label. For instance, the Click event handler of your home1Button would look like this:
VB.NET:
Me.home1 += 1
Me.home1Label.Text = Me.home1.ToString()
Me.UpdateHomeTotal()
Your UpdateHomeTotal method would look like this:
VB.NET:
Me.homeTotal = Me.home1 + 3 * Me.home3 + 6 * Me.home6 + 9 * Me.home9
Me.homeTotalLabel.Text = Me.homeTotal.ToString()
You'd use similar code for the other Buttons and an UpdateAwayTotal method.
 
Thanks for your help. I've almost finished. Just having trouble playing an embedded wav file (siren.wav) by clicking on btnSiren.

Still searching around and hopefully I'll be done tonight (aussie time).
 
Back
Top