Private Sub ResultWinner()
Dim count As Integer
If DetermineWinner() = 1 Then
pic_DisplayResult2.Image = Image.FromFile(Application.StartupPath & "\Visual basic\You Win!.bmp")
pic_DisplayResult.Image = Image.FromFile(Application.StartupPath & "\Visual basic\You Lose!.bmp")
score1 += 100
P1DisplayScore()
ElseIf DetermineWinner() = 2 Then
pic_DisplayResult.Image = Image.FromFile(Application.StartupPath & "\Visual basic\You Win!.bmp")
pic_DisplayResult2.Image = Image.FromFile(Application.StartupPath & "\Visual basic\You Lose!.bmp")
score2 += 100
P2DisplayScore()
Else
For count = 1 To 9
'arrPic(count) = nothing works everywhere else. Why doesnt it work here?
If arrPic(count) = Nothing Then
Else
pic_DisplayResult.Image = Image.FromFile(Application.StartupPath & "\Visual basic\Draw.bmp")
pic_DisplayResult2.Image = Image.FromFile(Application.StartupPath & "\Visual basic\Draw.bmp")
End If
Next count
End If
End Sub
Naughts and Crosses- VB.NET
hey,
i have a coding problem for the results of winning that is to stubborn to work! at the moment i have picture boxes for this two player game that show whether you have won, lost or drawn. the thing is its always draw until someone wins. i know what i have to do to get it right but its not working. pleaze help me.
the line it doesnt like in this code is "If arrPic(count) = Nothing Then". it comes up with an error message saying
"Error 1 Operator '=' is not defined for types 'System.Windows.Forms.PictureBox' and 'System.Windows.Forms.PictureBox'."
I don't code in VB.NET, so this may not really be the correct solution.
Try doing
Also, can you show me where/how you declare arrPic ?
EDIT:
Why not just do this?
Try doing
If arrPic(count) Is Nothing Then
Also, can you show me where/how you declare arrPic ?
EDIT:
Why not just do this?
For count = 1 To 9 'arrPic(count) = nothing works everywhere else. Why doesnt it work here? If arrPic(count) IsNot Nothing Then pic_DisplayResult.Image = Image.FromFile(Application.StartupPath & "\Visual basic\Draw.bmp") pic_DisplayResult2.Image = Image.FromFile(Application.StartupPath & "\Visual basic\Draw.bmp") End If Next count
that takes away the squigly lines but it does the same thing when run. here is where i stated arrPic:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SetControlArray() End SubPrivate Sub SetControlArray() arrPic(1) = PictureBox1 arrPic(2) = PictureBox2 arrPic(3) = PictureBox3 arrPic(4) = PictureBox4 arrPic(5) = PictureBox5 arrPic(6) = PictureBox6 arrPic(7) = PictureBox7 arrPic(8) = PictureBox8 arrPic(9) = PictureBox9 End Sub
Quote:Original post by AncientHunter
that takes away the squigly lines
Which squiggly lines are you talking about?
in VB.Net when it finds errors (some) it puts blue squigly lines under it to say that you screwed up something. that line is gone now but it still refuses to work.
when i run the program? well as soon as i make a move for either player the picturebox shows a picture saying "DRAW" until someone wins and it changes to "win" or "lose"
I still don't understand.
Can you explain what is supposed to happen?
Can you explain what actually happens?
Can you explain what is supposed to happen?
Can you explain what actually happens?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement