Code: Select all
Public Class Form1
Public CheckTextNUM(5), TL(10)
Public r1, r2, q1, q2, checkNUM, Hidit As Single
Public Quest, Answer, FA1, FA2, qu1, qu2, cool, FourQu(5), ProperStr(5), TS(10), AN(10) As String
' Private Property cool As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Randomize()
r2 = Int(Rnd(1) * 50)
For x = 1 To r2
cool = ""
For t = 1 To 28
r1 = Int(Rnd(1) * 77)
cool = cool + Chr(r1 + 48)
Next t
Next x
q1 = Int(Rnd(1) * 4) + 2
q2 = Int(Rnd(1) * 4) + 2
If q1 = 1 Then qu1 = "one"
If q1 = 2 Then qu1 = "two"
If q1 = 3 Then qu1 = "three"
If q1 = 4 Then qu1 = "four"
If q1 = 5 Then qu1 = "five"
If q1 = 6 Then qu1 = "six"
If q2 = 1 Then qu2 = "one"
If q2 = 2 Then qu2 = "two"
If q2 = 3 Then qu2 = "three"
If q2 = 4 Then qu2 = "four"
If q2 = 5 Then qu2 = "five"
If q2 = 6 Then qu2 = "six"
' Quest = "With the exception of the last character (:), what are the first " & qu1 & " characters and last " & qu2 & " characters of " & cool
If CheckBox1.Checked = True Then Quest = "With the exception of the last character (:), what are the last " & qu2 & " characters and first " & qu1 & " characters of " & cool _
Else Quest = "With the exception of the last character (:), what are the first " & qu1 & " characters and last " & qu2 & " characters of " & cool
FA1 = Microsoft.VisualBasic.Left(cool, q1) : FA2 = Microsoft.VisualBasic.Right(cool, q2)
If CheckBox1.Checked = True Then Answer = FA2 & FA1 Else Answer = FA1 & FA2
TextBox1.Text = Quest
TextBox2.Text = Answer
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
Randomize()
r2 = Int(Rnd(1) * 10)
For x = 1 To r2
FourQu(1) = ""
For t = 1 To Int(Rnd(1) * 4) + 4
r1 = Int(Rnd(1) * 77)
If Chr(r1 + 48) <> TextBox20.Text Or Chr(r1 + 48) <> TextBox21.Text Then FourQu(1) = FourQu(1) + Chr(r1 + 48) Else t = t - 1
Next t
Next x
TextBox3.Text = FourQu(1)
End Sub
Private Sub CheckBox2_CheckStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckStateChanged
If CheckBox2.Checked = False Then TextBox3.Text = "" Else TextBox3.Text = FourQu(1)
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
CHThemAll()
End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
Randomize()
r2 = Int(Rnd(1) * 10)
For x = 1 To r2
FourQu(2) = ""
For t = 1 To Int(Rnd(1) * 4) + 4
r1 = Int(Rnd(1) * 77)
If Chr(r1 + 48) <> TextBox20.Text Or Chr(r1 + 48) <> TextBox21.Text Then FourQu(2) = FourQu(2) + Chr(r1 + 48) Else t = t - 1
Next t
Next x
TextBox4.Text = FourQu(2)
End Sub
Private Sub CheckBox3_CheckStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckStateChanged
If CheckBox3.Checked = False Then TextBox4.Text = "" Else TextBox4.Text = FourQu(2)
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
CHThemAll()
End Sub
Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
Randomize()
r2 = Int(Rnd(1) * 10)
For x = 1 To r2
FourQu(3) = ""
For t = 1 To Int(Rnd(1) * 4) + 4
r1 = Int(Rnd(1) * 77)
If Chr(r1 + 48) <> TextBox20.Text Or Chr(r1 + 48) <> TextBox21.Text Then FourQu(3) = FourQu(3) + Chr(r1 + 48) Else t = t - 1
Next t
Next x
TextBox5.Text = FourQu(3)
End Sub
Private Sub CheckBox4_CheckStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckStateChanged
If CheckBox4.Checked = False Then TextBox5.Text = "" Else TextBox5.Text = FourQu(3)
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
CHThemAll()
End Sub
Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged
Randomize()
r2 = Int(Rnd(1) * 10)
For x = 1 To r2
FourQu(4) = ""
For t = 1 To Int(Rnd(1) * 4) + 4
r1 = Int(Rnd(1) * 77)
If Chr(r1 + 48) <> TextBox20.Text Or Chr(r1 + 48) <> TextBox21.Text Then FourQu(4) = FourQu(4) + Chr(r1 + 48) Else t = t - 1
Next t
Next x
TextBox6.Text = FourQu(4)
End Sub
Private Sub CheckBox5_CheckStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckStateChanged
If CheckBox5.Checked = False Then TextBox6.Text = "" Else TextBox6.Text = FourQu(4)
End Sub
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
CHThemAll()
End Sub
Public Sub CHThemAll()
' First Word
CheckTextNUM(1) = Len(TextBox3.Text)
For t = 1 To CheckTextNUM(1)
If Mid(TextBox3.Text, t, 1) = TextBox20.Text Or Mid(TextBox3.Text, t, 1) = TextBox21.Text Then TextBox3.Text = "" : t = CheckTextNUM(1)
Next t
' Second Word
CheckTextNUM(2) = Len(TextBox4.Text)
For t = 1 To CheckTextNUM(2)
If Mid(TextBox4.Text, t, 1) = TextBox20.Text Or Mid(TextBox4.Text, t, 1) = TextBox21.Text Then TextBox4.Text = "" : t = CheckTextNUM(2)
Next t
' Third Word
CheckTextNUM(3) = Len(TextBox5.Text)
For t = 1 To CheckTextNUM(3)
If Mid(TextBox5.Text, t, 1) = TextBox20.Text Or Mid(TextBox5.Text, t, 1) = TextBox21.Text Then TextBox5.Text = "" : t = CheckTextNUM(3)
Next t
' Fourth Word
CheckTextNUM(4) = Len(TextBox6.Text)
For t = 1 To CheckTextNUM(4)
If Mid(TextBox6.Text, t, 1) = TextBox20.Text Or Mid(TextBox6.Text, t, 1) = TextBox21.Text Then TextBox6.Text = "" : t = CheckTextNUM(4)
Next t
End Sub
Private Sub TextBox20_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox20.TextChanged
CHThemAll()
End Sub
Private Sub TextBox21_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox21.TextChanged
CHThemAll()
End Sub
Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
Randomize()
r1 = Int(Rnd(1) * 77)
TextBox20.Text = Chr(r1 + 48)
r1 = Int(Rnd(1) * 77)
TextBox21.Text = Chr(r1 + 48)
CHThemAll()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' Arange the textbox's Start
For t = 3 To 6
AN(t) = ""
Next
TL(3) = Len(TextBox3.Text) : TS(3) = TextBox3.Text
TL(4) = Len(TextBox4.Text) : TS(4) = TextBox4.Text
TL(5) = Len(TextBox5.Text) : TS(5) = TextBox5.Text
TL(6) = Len(TextBox6.Text) : TS(6) = TextBox6.Text
TS(1) = TextBox20.Text
TS(2) = TextBox21.Text
' Arange the textbox's End
For t = 3 To 6
TL(10) = Int(Rnd(1) * 10) + 1
If TL(10) <= 5 Then TL(10) = 1 Else TL(10) = 2
For x = 1 To TL(t)
Hidit = Int(Rnd(1) * 10) + 1
If Hidit <= 5 Then Hidit = 1 Else Hidit = 2
If TL(10) = 1 Then AN(t) = AN(t) & Mid(TS(t), x, 1) & TS(Hidit) Else AN(t) = AN(t) & TS(Hidit) & Mid(TS(t), x, 1)
Next x
Next t
TextBox30.Text = AN(3) & " " & AN(4) & " " & AN(5) & " " & AN(6) & " " & "Please Disregard '" _
& TS(1) & "', '" & TS(2) & "', and put the four words in order, use one space between each word in the answer."
TextBox31.Text = TS(3) & " " & TS(4) & " " & TS(5) & " " & TS(6)
End Sub
End Class