Counting points
-
Hi! I have a problem with my program. It is a small game, in which the two players (user and computer) receive one point when winning. First to three points will win the whole game. The problem is that after the players recieve their first point, and win again, they don't recieve any more points. What's the problem?
Dim V_DuVin As Boolean Dim V_DatVin As Boolean Dim V_DinPoang As Integer Dim V_DatPoang As Integer If V_DuVin = True Then V_DinPoang = V_DinPoang + 1 Else If V_DatVin = True Then V_DatPoang = V_DatPoang + 1 End If
//OT -
Hi! I have a problem with my program. It is a small game, in which the two players (user and computer) receive one point when winning. First to three points will win the whole game. The problem is that after the players recieve their first point, and win again, they don't recieve any more points. What's the problem?
Dim V_DuVin As Boolean Dim V_DatVin As Boolean Dim V_DinPoang As Integer Dim V_DatPoang As Integer If V_DuVin = True Then V_DinPoang = V_DinPoang + 1 Else If V_DatVin = True Then V_DatPoang = V_DatPoang + 1 End If
//OTVB:
Dim V_DuVin As Boolean
Dim V_DatVin As Boolean
Dim V_DinPoang As Integer
Dim V_DatPoang As Integer
'////BELOW WINDOWS GENERATED CODE AREA^^^^.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
V_DuVin = True
End SubPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If V_DuVin = True Then
V_DinPoang = V_DinPoang + 1
ElseIf V_DatVin = True Then
V_DatPoang = V_DatPoang + 1
End If
MessageBox.Show(V_DinPoang)
End Sub
you must have the items dimmed on a main part of the form , like just below the windows generated code , otherwise the values will reset each time if they are only declared in a sub.:)
Private void ExpectingTwins(string twins)
{
switch(twins)
{
Case ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
break;
}
}
-
Hi! I have a problem with my program. It is a small game, in which the two players (user and computer) receive one point when winning. First to three points will win the whole game. The problem is that after the players recieve their first point, and win again, they don't recieve any more points. What's the problem?
Dim V_DuVin As Boolean Dim V_DatVin As Boolean Dim V_DinPoang As Integer Dim V_DatPoang As Integer If V_DuVin = True Then V_DinPoang = V_DinPoang + 1 Else If V_DatVin = True Then V_DatPoang = V_DatPoang + 1 End If
//OT -
VB:
Dim V_DuVin As Boolean
Dim V_DatVin As Boolean
Dim V_DinPoang As Integer
Dim V_DatPoang As Integer
'////BELOW WINDOWS GENERATED CODE AREA^^^^.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
V_DuVin = True
End SubPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If V_DuVin = True Then
V_DinPoang = V_DinPoang + 1
ElseIf V_DatVin = True Then
V_DatPoang = V_DatPoang + 1
End If
MessageBox.Show(V_DinPoang)
End Sub
you must have the items dimmed on a main part of the form , like just below the windows generated code , otherwise the values will reset each time if they are only declared in a sub.:)
Private void ExpectingTwins(string twins)
{
switch(twins)
{
Case ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
break;
}
}
Thanks. The problems are solved. //OT