Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Visual Basic Projects: Scoreboard, Making a scoreboard with Visual Basic 6
William Wood
post Aug 21 2007, 07:44 AM
Post #1


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 7
Joined: 9-August 07
Member No.: 23,941



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.


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.
-----------------------------------
CODE
Option Explicit
          Dim TotalLions As Integer
          Dim TotalSwans As Integer

-----------------------------------
Now, change the coding place to Form1 and Load. Insert this programming now.
-----------------------------------
CODE
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.
-----------------------------------
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.
-----------------------------------
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 smile.gif.

Notice from WeaponX:
Please use CODE tags whenever you post any kind of code.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. [visual Basic] How To Confirm A Array Is Null(6)
  2. Visual Basic Help(7)
  3. Visual Basic: Replace Explained!(4)
  4. Visual Basic: Unload Your Application Correctly!(1)
  5. Visual Basic: Change Your Start Button Text! (XP)(16)
  6. Visual Basic: Random Strings!(10)
  7. Visual Basic 6 + Crystal Reports 9(6)
  8. Oh Man, Need Help Making Basic Calc In Console App(5)
  9. Visual Basic Names(11)
  10. New Features In Visual Studio 2005 Windows Forms(1)
  11. Visual Basic.NET Help Needed.(8)
  12. Is There A Free IDE For VB.NET Programming?(4)
  13. Visual Basic Express Tutorials(5)
  14. [help] Visual Studio .net 2005 Questions(8)
  15. Installed Internet Explorer 7?, Visual Basic Now Broken?(3)
  1. Delete A Registry Subkey And Key(8)
  2. Necklace Problem In Visual Basic(3)


 



- Lo-Fi Version Time is now: 5th December 2008 - 03:19 PM