I know you guys are normally not usually willing to mess with stuff like this because it is so beginner, but i'm in need of major help. I have already created the code for the game it self, and it works perfectly fine. I now want to know how to record the results of each game to a text file. Here is my current code. I know I have to create a streamwriter and reader to open, but am a bit lost. Is it possible with my current code or do I need to start over completely? Thanks in advance!
Public Class Form1
Private Sub rock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rock.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
player.image = rock.Image
computerChoice = randomGenerator.Next(1, 4)
If computerChoice = 1 Then
computer.image = rock.Image
winner.Text = "Tie"
ElseIf computerChoice = 2 Then
computer.image = paper.Image
winner.Text = "Computer wins because paper covers rock."
ElseIf computerChoice = 3 Then
computer.Image = scissors.Image
winner.Text = "Player wins because rock shatters scissors."
End If
End Sub
Private Sub paper_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles paper.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
player.Image = paper.Image
computerChoice = randomGenerator.Next(1, 4)
If computerChoice = 1 Then
computer.Image = rock.Image
winner.Text = "Player wins because paper covers rock."
ElseIf computerChoice = 2 Then
computer.Image = paper.Image
winner.Text = "Tie."
ElseIf computerChoice = 3 Then
computer.Image = scissors.Image
winner.Text = "Computer wins because scissors cuts paper."
End If
End Sub
Private Sub scissors_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles scissors.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
player.Image = scissors.Image
computerChoice = randomGenerator.Next(1, 4)
If computerChoice = 1 Then
computer.Image = rock.Image
winner.Text = "Computer wins because rock shatters scissors."
ElseIf computerChoice = 2 Then
computer.Image = paper.Image
winner.Text = "Player wins because scissors cuts paper."
ElseIf computerChoice = 3 Then
computer.Image = scissors.Image
winner.Text = "Tie."
End If
End Sub
End Class