Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

LINE IDENTIFIER APPLICATION IN VB.Net

LINE IDENTIFIER APPLICATION IN VB.NET Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Randomize() ResetForm() End Sub Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click ResetForm() End Sub Public Sub ResetForm() TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() TextBox9.Clear() TextBox10.Clear() TextBox11.Clear() TextBox12.Clear() TextBox13.Clear() TextBox14.Clear() TextBox15.Clear() TextBox16.Clear() TextBox17.Clear() TextBox18.Clear() Ask for more?.. Twitter : IamHolong Facebook : https://www.facebook.com/Holong.Marisi.boru.Simalango TextBox19.Clear() TextBox20.Clear() TextBox21.Clear() TextBox22.Clear() TextBox23.Clear() TextBox24.Clear() TextBox25.Clear() End Sub Private Sub Cek_Numerik(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress, TextBox4.KeyPress, TextBox5.KeyPress, TextBox9.KeyPress, TextBox8.KeyPress, TextBox7.KeyPress, TextBox6.KeyPress, TextBox25.KeyPress, TextBox24.KeyPress, TextBox23.KeyPress, TextBox22.KeyPress, TextBox21.KeyPress, TextBox20.KeyPress, TextBox19.KeyPress, TextBox18.KeyPress, TextBox17.KeyPress, TextBox16.KeyPress, TextBox15.KeyPress, TextBox14.KeyPress, TextBox13.KeyPress, TextBox12.KeyPress, TextBox11.KeyPress, TextBox10.KeyPress Dim key As Integer = Char.ConvertToUtf32(e.KeyChar.ToString(), 0) If Not (((key >= 48) And (key <= 57)) Or (key = 8)) Then e.Handled = True End If End Sub Private Sub btnDeteksi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeteksi.Click Dim matriks(,) As String = {{TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text}, {TextBox6.Text, TextBox7.Text, TextBox8.Text, TextBox9.Text, TextBox10.Text}, {TextBox11.Text, TextBox12.Text, TextBox13.Text, TextBox14.Text, TextBox15.Text}, {TextBox16.Text, TextBox17.Text, TextBox18.Text, TextBox19.Text, TextBox20.Text}, {TextBox21.Text, TextBox22.Text, TextBox23.Text, TextBox24.Text, TextBox25.Text}} Dim awalX As Integer = 0 Dim awalY As Integer = 0 Dim ujungX As Integer = 0 Dim ujungY As Integer = 0 For i As Integer = 0 To 4 For j As Integer = 0 To 4 If matriks(i, j) = "1" Then awalX = i awalY = j Exit For End If Next Next For i As Integer = 4 To 0 Step -1 For j As Integer = 4 To 0 Step -1 If matriks(i, j) = "1" Then ujungX = i ujungY = j Exit For Ask for more?.. Twitter : IamHolong Facebook : https://www.facebook.com/Holong.Marisi.boru.Simalango End If Next Next If (awalX = ujungX) Then MessageBox.Show("Horisontal !", "Coba Tanda Lain", MessageBoxButtons.OK, MessageBoxIcon.Information) ElseIf (awalY = ujungY) Then MessageBox.Show("Vertikal !", "Coba Tanda Lain", MessageBoxButtons.OK, MessageBoxIcon.Information) ElseIf ((ujungX - awalX) = (ujungY - awalY)) Then MessageBox.Show("Diagonal (\) !", "Coba Tanda Lain", MessageBoxButtons.OK, MessageBoxIcon.Information) ElseIf ((awalX = ujungY)) Then MessageBox.Show("Diagonal (/) !", "Coba Tanda Lain", MessageBoxButtons.OK, MessageBoxIcon.Information) ElseIf ((awalX = 0) And (awalY = 0) And (ujungX = 0) And (ujungY = 0)) Then MessageBox.Show("Masukkan Tanda !", "Coba Tanda Lain", MessageBoxButtons.OK, MessageBoxIcon.Information) Else MessageBox.Show("Bukan Horizontal/Vertikal/Diagonal !", "Coba Tanda Lain", MessageBoxButtons.OK, MessageBoxIcon.Information) End If ResetForm() End Sub End Class Ask for more?.. Twitter : IamHolong Facebook : https://www.facebook.com/Holong.Marisi.boru.Simalango