• Best of luck to the class of 2024 for their HSC exams. You got this!
    Let us know your thoughts on the HSC exams here
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page
MedVision ad

Help with my Major! (1 Viewer)

InsanityIsReal

New Member
Joined
Jul 9, 2013
Messages
6
Gender
Female
HSC
2013
Hello, this is my first post on BOS so I hope this is ok.
Here is my code (Visual Basic). It's for a Hangman Game. Basically I want to loop the stuff highlighted in blue but it doesn't work. (When I do nothing else runs, I can't even close the form). Any ideas? Please and thank you.


Public Class Form1


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Visible = True
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim Damage As Integer
Damage = 0

Dim FindThisString As String
FindThisString = TextBox1.Text

Dim Word_Car(3) As String
Word_Car(1) = "C"
Word_Car(2) = "A"
Word_Car(3) = "R"


Dim takeDamage As Boolean
takeDamage = True

If Word_Car(1).Contains(FindThisString) Then
Label_C.Visible = True
takeDamage = False
End If

If Word_Car(2).Contains(FindThisString) Then
Label_A.Visible = True
takeDamage = False
End If

If Word_Car(3).Contains(FindThisString) Then
Label_R.Visible = True
takeDamage = False
End If

If takeDamage = True Then
Damage = Damage + 1
End If


Dim Score_Car(9) As Integer
Score_Car(1) = 9
Score_Car(2) = 8
Score_Car(3) = 7
Score_Car(4) = 6
Score_Car(5) = 5
Score_Car(6) = 4
Score_Car(7) = 3
Score_Car(8) = 2
Score_Car(9) = 1

If Damage = 1 Then
Label_9.Visible = True
End If
If Damage = 2 Then
Label_8.Visible = True
End If
If Damage = 3 Then
Label_7.Visible = True
End If
If Damage = 4 Then
Label_6.Visible = True
End If
If Damage = 5 Then
Label_5.Visible = True
End If
If Damage = 5 Then
Label_4.Visible = True
End If
If Damage = 7 Then
Label_3.Visible = True
End If
If Damage = 8 Then
Label_2.Visible = True
End If
If Damage = 9 Then
Label_1.Visible = True
End If

End Sub
End Class
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top