Untuk Membuat Game TTS (Teka Teki Silang) Menggunakan Visual Basic 2008/VB.net anda harus mengerti terlebih dahulu jawaban dari pertanyaan yang akan anda buat dan mampu menghitung jumlah huruf dari setiap jawaban dari pertanyaan yang dibuat tersbut, kemudian harus bisa menggabungkan 2 jawaban atau lebih menjadi satu rangkaian kata dengan metode mendatar dan menurun.
Membuat Game TTS (Teka Teki Silang) Menggunakan Visual Basic 2008/VB.net susah-susah mudah sebenarnya, karena harus benar-benar jeli dan tau betul rancangan If & Then.
Karena rancangan If & Then ini tidak seperti If & Then sederhana yang hanya menggunakan 1 Alasan saja akan tetapi logika awalnya seperti ini Jika textbox1.text=A atau textbox1.text=a dan textboxt2.text=B atau textbox2.text=b maka label1.text=benar.
Baiklah untuk mempersingkat waktu dan tempat juga penulisan maka saya akan memulai pembuatan Game TTS ini, buatlah satu form dengan komponen:
- 32 Textbox
- 5 Label
- 1 Picturebox
Lihat gambar dibawah ini dan buatlah agar persis seperti gambar dibawah ini:
Selanjutnya klik 2 kali formnya, hapus semua kode yang sudah ada dan masukkan kode dibawah ini:
Public Class Form1
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Enabled = False
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
TextBox2.Enabled = False
If (TextBox1.Text = "a" Or TextBox1.Text = "A") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "u" Or TextBox3.Text = "U") Then
Label3.Text += 1
ElseIf (TextBox1.Text = "" Or TextBox1.Text = "") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "u" Or TextBox3.Text = "U") Then
Label3.Text = Label3.Text
ElseIf (TextBox1.Text = "" Or TextBox1.Text = "") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "" Or TextBox3.Text = "") Then
Label3.Text = Label3.Text
ElseIf (TextBox1.Text = "a" Or TextBox1.Text = "A") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "" Or TextBox3.Text = "") Then
Label3.Text = Label3.Text
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
TextBox3.Enabled = False
If (TextBox1.Text = "a" Or TextBox1.Text = "A") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "u" Or TextBox3.Text = "U") Then
Label3.Text += 1
ElseIf (TextBox1.Text = "" Or TextBox1.Text = "") And (TextBox2.Text = "" Or TextBox2.Text = "") And (TextBox3.Text = "u" Or TextBox3.Text = "U") Then
Label3.Text = Label3.Text
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
TextBox4.Enabled = False
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
TextBox5.Enabled = False
End Sub
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
TextBox6.Enabled = False
If (TextBox4.Text = "l" Or TextBox4.Text = "L") And (TextBox5.Text = "a" Or TextBox5.Text = "A") And (TextBox6.Text = "r" Or TextBox6.Text = "R") Then
Label3.Text += 1
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
TextBox7.Enabled = False
End Sub
Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
TextBox8.Enabled = False
End Sub
Private Sub TextBox9_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox9.TextChanged
TextBox9.Enabled = False
End Sub
Private Sub TextBox10_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox10.TextChanged
TextBox10.Enabled = False
If (TextBox7.Text = "a" Or TextBox7.Text = "A") And (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox9.Text = "g" Or TextBox9.Text = "G") And (TextBox10.Text = "e" Or TextBox10.Text = "E") Then
Label3.Text += 1
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox11_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox11.TextChanged
TextBox11.Enabled = False
End Sub
Private Sub TextBox12_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox12.TextChanged
TextBox12.Enabled = False
End Sub
Private Sub TextBox13_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox13.TextChanged
TextBox13.Enabled = False
If (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "o" Or TextBox11.Text = "O") And (TextBox12.Text = "b" Or TextBox12.Text = "B") And (TextBox13.Text = "o" Or TextBox13.Text = "O") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
Label3.Text += 1
ElseIf (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "" Or TextBox11.Text = "") And (TextBox12.Text = "" Or TextBox12.Text = "") And (TextBox13.Text = "" Or TextBox13.Text = "") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
Label3.Text = Label3.Text
ElseIf (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "o" Or TextBox11.Text = "O") And (TextBox12.Text = "b" Or TextBox12.Text = "B") And (TextBox13.Text = "o" Or TextBox13.Text = "O") And (TextBox14.Text = "" Or TextBox14.Text = "") Then
Label3.Text = Label3.Text
ElseIf (TextBox8.Text = "" Or TextBox8.Text = "") And (TextBox11.Text = "" Or TextBox11.Text = "") And (TextBox12.Text = "" Or TextBox12.Text = "") And (TextBox13.Text = "" Or TextBox13.Text = "") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
Label3.Text = Label3.Text
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox14_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox14.TextChanged
TextBox14.Enabled = False
If (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "o" Or TextBox11.Text = "O") And (TextBox12.Text = "b" Or TextBox12.Text = "B") And (TextBox13.Text = "o" Or TextBox13.Text = "O") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
Label3.Text += 1
ElseIf (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "" Or TextBox11.Text = "") And (TextBox12.Text = "" Or TextBox12.Text = "") And (TextBox13.Text = "" Or TextBox13.Text = "") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
Label3.Text = Label3.Text
ElseIf (TextBox8.Text = "" Or TextBox8.Text = "") And (TextBox11.Text = "" Or TextBox11.Text = "") And (TextBox12.Text = "" Or TextBox12.Text = "") And (TextBox13.Text = "" Or TextBox13.Text = "") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
Label3.Text = Label3.Text
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox20_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox20.TextChanged
TextBox20.Enabled = False
If (TextBox15.Text = "p" Or TextBox15.Text = "P") And (TextBox16.Text = "r" Or TextBox16.Text = "R") And (TextBox17.Text = "i" Or TextBox17.Text = "I") And (TextBox18.Text = "n" Or TextBox18.Text = "N") And (TextBox14.Text = "t" Or TextBox14.Text = "T") And (TextBox19.Text = "e" Or TextBox19.Text = "E") And (TextBox20.Text = "r" Or TextBox20.Text = "R") Then
Label3.Text += 1
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox15_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox15.TextChanged
TextBox15.Enabled = False
End Sub
Private Sub TextBox16_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox16.TextChanged
TextBox16.Enabled = False
End Sub
Private Sub TextBox17_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox17.TextChanged
TextBox17.Enabled = False
End Sub
Private Sub TextBox18_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox18.TextChanged
TextBox18.Enabled = False
End Sub
Private Sub TextBox19_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox19.TextChanged
TextBox19.Enabled = False
End Sub
Private Sub TextBox21_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox21.TextChanged
TextBox21.Enabled = False
End Sub
Private Sub TextBox22_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox22.TextChanged
TextBox22.Enabled = False
End Sub
Private Sub TextBox23_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox23.TextChanged
TextBox23.Enabled = False
End Sub
Private Sub TextBox24_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox24.TextChanged
TextBox24.Enabled = False
If (TextBox15.Text = "p" Or TextBox15.Text = "P") And (TextBox21.Text = "u" Or TextBox21.Text = "U") And (TextBox22.Text = "a" Or TextBox22.Text = "A") And (TextBox23.Text = "s" Or TextBox23.Text = "S") And (TextBox24.Text = "a" Or TextBox24.Text = "A") Then
Label3.Text += 1
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox25_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox25.TextChanged
TextBox25.Enabled = False
End Sub
Private Sub TextBox26_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox26.TextChanged
TextBox26.Enabled = False
End Sub
Private Sub TextBox27_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox27.TextChanged
TextBox27.Enabled = False
End Sub
Private Sub TextBox28_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox28.TextChanged
TextBox28.Enabled = False
End Sub
Private Sub TextBox29_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox29.TextChanged
TextBox29.Enabled = False
If (TextBox22.Text = "a" Or TextBox22.Text = "A") And (TextBox25.Text = "m" Or TextBox25.Text = "M") And (TextBox26.Text = "a" Or TextBox26.Text = "A") And (TextBox27.Text = "n" Or TextBox27.Text = "N") And (TextBox28.Text = "a" Or TextBox28.Text = "A") And (TextBox29.Text = "t" Or TextBox29.Text = "T") Then
Label3.Text += 1
Else
Label4.Text += 1
End If
End Sub
Private Sub TextBox30_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox30.TextChanged
TextBox30.Enabled = False
End Sub
Private Sub TextBox31_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox31.TextChanged
TextBox31.Enabled = False
End Sub
Private Sub TextBox32_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox32.TextChanged
TextBox32.Enabled = False
If (TextBox18.Text = "n" Or TextBox18.Text = "N") And (TextBox30.Text = "e" Or TextBox30.Text = "E") And (TextBox27.Text = "n" Or TextBox27.Text = "N") And (TextBox31.Text = "e" Or TextBox31.Text = "E") And (TextBox32.Text = "k" Or TextBox32.Text = "K") Then
Label3.Text += 1
Else
Label4.Text += 1
End If
End Sub
Private Sub Label3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label3.TextChanged
If Label3.Text = 9 Then
MsgBox("Otak anda cerdas juga yah...")
End If
End Sub
Private Sub Label4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label4.TextChanged
If Label4.Text >= 9 Then
MsgBox("Otak anda sepertinya perlu dibawa kedokter jiwa...")
End If
End Sub
Private Sub TextBox33_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox33.TextChanged
TextBox33.Enabled = False
If (TextBox20.Text = "r" Or TextBox20.Text = "R") And (TextBox33.Text = "s" Or TextBox33.Text = "S") Then
Label3.Text += 1
Else
Label4.Text += 1
End If
End Sub
End Class
Gan bisa buat aplikasinya yang uda jadi?
ReplyDeleteBisa buat aplikasinya Ndak ya
ReplyDelete