Notes
Notes - notes.io |
' Assigns variables
' Assign array and position of "index"
Dim MyArray(5) As String
Dim IndexPos As Integer = 0
Dim MyArray2(5) As String
Dim IndexPos2 As Integer = 0
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Add subjects to the Array (Populate Array)
MyArray(0) = " 0 "
MyArray(1) = " 15 "
MyArray(2) = " 30 "
MyArray(3) = " 40 "
MyArray(4) = " Deuce"
MyArray(5) = " Player 1 Wins "
' Array will stay on 0 when button not clicked. Displays
NextArrayItem(0)
' Add subjects to the Array (Populate Array)
MyArray2(0) = " 0 "
MyArray2(1) = " 15 "
MyArray2(2) = " 30 "
MyArray2(3) = " 40 "
MyArray2(4) = " Deuce"
MyArray2(5) = " Player 2 Wins "
' Array will stay on 0 when button not clicked. Displays 0
NextArrayItem2(0)
End Sub
' Sets the positive and negative value of next array item
' So that when btn is clikced it will travel from MyArray(0) to MyArray (5)
Private Sub NextArrayItem(Index As Integer)
IndexPos += Index
' Avoids going outside the Array
' ElseIf loop allows message box to show on a deuce
If IndexPos < 0 Then
IndexPos = 5
ElseIf IndexPos > 5 Then
IndexPos = 0
ElseIf IndexPos = 4 Then
MsgBox("Deuce")
End If
'Sets Text plyer 1 output
txtScorePlayer1.Text = MyArray(IndexPos)
End Sub
' Sets the positive and negative value of next array item
' So that when btn is clikced it will travel from MyArray(0) to MyArray (5)
Private Sub NextArrayItem2(Index2 As Integer)
IndexPos2 += Index2
' Avoids going outside the Array
' ElseIf loop allows message box to show on a deuce
If IndexPos2 < 0 Then
IndexPos2 = 5
ElseIf IndexPos2 > 5 Then
IndexPos2 = 0
ElseIf IndexPos2 = 4 Then
MsgBox("Deuce")
End If
'Sets text player 2 output
txtScorePlayer2.Text = MyArray2(IndexPos2)
End Sub
' When button is clicked will add 15 points to text output of player 1, cycles through the array.
' Until reaching value 5 (Game Player 1). Score Then resets To 0
Private Sub btnPlayer1_Click(sender As Object, e As EventArgs) Handles btnPlayer1.Click
NextArrayItem(+1)
End Sub
' When button is clicked will add 15 points to text output of player 2, cycles through the array.
' Until reaching value 5 (Game Player 1). Score Then resets To 0
Private Sub btnPlayer2_Click(sender As Object, e As EventArgs) Handles btnPlayer2.Click
NextArrayItem2(+1)
End Sub
End Class
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team