Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Replying to Visual Basic Projects: Scoreboard


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

Posted 13 April 2011 - 06:53 PM

can anyone help cant get football scoreboard to work VB2010Visual Basic Projects: Scoreboard

I am building for a football team can enter their points and it will display points and total points and a final Score.The message box opens and you enter the point and the point then suppose to go into the listbox. I can't to get the points to go in the list box and calculate the final score. This my code could anyone please helpMe.

Dim strTotalofallScores As StringDim DecTotalofallScores As Decimal = 0DDim strInputMessage As String = "Enter the Score #"Dim strInputHeading As String = "Points Scored"Dim strNormalMessage As String = "Enter the Score #"Dim strNonnumericMessage As String = "Error-Enter a number for the Point Scored #"Dim strNegativeError As String = "Error-Enter a positive number for Points Scored#"' Declare and initialize loop variablesDim intMaxNumberOfEntries As Integer = 10Dim intNumberOfEntries As Integer = 1' This loop allows the user to enter the point Scored of up to 10 Scores' the loop terminates when the user has entered 10 scores or the userStrScores = InputBox (strInputMessage & intNumberOfEntries, strInputHeading, "")Do Until intNumberOfEntries > intMaxNumberOfEntries = decTotalofallScore()If IsNumeric (decScores) ThenDecScores = Convert.ToDecimal (strScores)If decScores > 0 ThenLstScores.Items.Add (decScores)DecTotalofallScores += DecTotalofallScoresIntNumberOfEntries += 1StrInputMessage = strNormalMessageElseStrInputMessage = strNegativeErrorEnd IfElseStrInputMessage = strNonnumericMessageEnd IfIf intNumberOfEntries <= intMaxNumberOfEntries ThenStrScores = InputBox (StrInputBoxMessage() & intNumberOfEntries, StringTrimming, "")End IfLoop' Makes label visibleLblTotalofallScore.Visible = True' Calculate and display average speedIf intNumberOfEntries > 1 ThenDecScores = decTotalofallScore()/(intNumberOfEntries - 1)LblTotalofallScore.Text = "Final Score is " & _DecTotalofallScore.ToString ("F1") & ""ElseLblTotalofallScore.Text = "No Score entered"End If'Disaables the Enter Score buttonBtnEnterScore.Enabled = False-question by linda

yordan

Posted 19 May 2010 - 08:19 PM

Seems to be very visual-basic-oriented.
So, in order to make it run, you must know the vb interface, and know how to run the project you are creating.
Maybe the visual basic online help can tell you how to run the main project.

Posted 18 May 2010 - 02:25 PM

How do I make the program run?Visual Basic Projects: Scoreboard

The lesson was great. I painted the Interface just like yours and in addition coded the program and it did compile but it never Displayed any thing on lble five and 6 at mouse click What is the problem?

-reply by Giddy TBay

 


William Wood

Posted 21 August 2007 - 07:44 AM

Hi again,
I've done another visual basic tutorial in this forum on how to make a simple, customized web browser. Now I am going to say how to make a scoreboard.
To do so, open a Standard EXE project in Visual Basic 6.0 and insert 6 labels and 2 command buttons. Change the captions on these to:

Label1: SCOREBOARD
Label2: LIONS
Label3: SWANS
Label4: 0
Label5: 0
Label6: Waiting for update...

Command1: TOUCHDOWN
Command2: TOUCHDOWN

Once you are done, it shoud look like this.
Posted Image

Press F5 now to see it in action. It won't do anything, seeing as how there is no path for it to follow. Now we ajust the coding part.
Double click anywhere on the project design. At the top, it should say 'Form1' or 'Command1' or 'Label1', etc. Change this to (General) and the one on the right to (Declarations).

Type this code where the cursor is blinking.
-----------------------------------
Option Explicit
		  Dim TotalLions As Integer
		  Dim TotalSwans As Integer
-----------------------------------
Now, change the coding place to Form1 and Load. Insert this programming now.
-----------------------------------
Private Sub Form_Load()
		  Label1.Caption = SCOREBOARD
		  Label4.Caption = 0
		  Label5.Caption = 0
		  Label6.Caption = GAME IS TIED
End Sub
-----------------------------------
Now in the Command1 coding place, insert this code.
-----------------------------------
Private Sub Command1_Click()
		   Label4.Caption = Label4.Caption + 6
		   TotalLions = TotalLions + 6
				If TotalLions > TotalSwans Then
				Label6.Caption = "LIONS LEAD"
		   ElseIf TotalSwans > TotalLions Then
				Label6.Caption = "SWANS LEAD"
		   Else
				Label6.Caption - "GAME IS TIED"
End Sub
-----------------------------------
And on Command2 button, insert this code.
-----------------------------------
Private Sub Command2_Click()
		   Label5.Caption = Label5.Caption + 6
		   TotalSwans = TotalSwans + 6
				If TotalSwans > TotalLions Then
				Label6.Caption = "SWANS LEAD"
		   ElseIf TotalLions > TotalSwans Then
				Label6.Caption = "LIONS LEAD"
		   Else
				Label6.Caption - "GAME IS TIED"
End Sub
-----------------------------------

I hope this has been useful. If you experience errors, please contact me :blink:.

[note=WeaponX]Please use CODE tags whenever you post any kind of code.[/note]

Review the complete topic (launches new window)