18.31

vb(dot) Net episode 6


Pada episode kali ini kita akan membuat form seperti ini





Langsung aja deh, kalo udah buat designnya sekarang,masukin syntax-syntaxnya






Public Class episode6_isan
    Dim isitex(4) As String
    Dim item As ListViewItem

Douyble klik pada form,lalu ubah menjadi windows activated,lalu masukan syntax ini
    Private Sub episode6_isan_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
        Call bersih()
        Call isikombo()
        Call tampilan()

    End Sub

Double klik pada button1 sampai button 4,isi syntax berikut
  

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Button1.Text = "tambah" Then
            Button1.Text = " simpan"
            Button2.Enabled = False
            Button3.Enabled = False
            Button4.Text = "batal"
            TextBox1.Focus()

        Else
            isitex(0) = Trim(TextBox1.Text)
            isitex(1) = Trim(TextBox2.Text)
            isitex(2) = Trim(TextBox3.Text)
            isitex(3) = Microsoft.VisualBasic.Left(Trim(ComboBox1.Text), 100)
)

            item = New ListViewItem(isitex)
            ListView1.Items.Add(item)

            Call bersih()
            TextBox1.Focus()


        End If


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If Button2.Text = "ubah" Then
            Button2.Text = "simpan"
            Button1.Enabled = "false"
            Button3.Enabled = "false"
            Button4.Text = "batal"
            TextBox1.Focus()
        Else

        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Call bersih()

        If Button3.Text = "hapus" Then
            Button3.Text = "simpan"
            Button1.Enabled = "false"
            Button2.Enabled = "false"
            Button4.Text = "batal"
            TextBox1.Focus()
        Else

        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If Button4.Text = "batal" Then
            Button1.Text = "tambah"
            Button1.Enabled = True
            Button2.Text = "ubah"
            Button2.Enabled = True
            Button3.Text = "Hapus"
            Button3.Enabled = True
            Button4.Text = "keluar"
            TextBox1.Focus()
        Else
            Button4.Text = "keluar"
            Me.Close()




            Call bersih()
            Call normal()
        End If
    End Sub
    Sub tampilan()
        ListView1.View = View.Details
        ListView1.Columns.Add("npm", 100, HorizontalAlignment.Center)
        ListView1.Columns.Add("nama", 100, HorizontalAlignment.Left)
        ListView1.Columns.Add("alamat", 200, HorizontalAlignment.Left)
        ListView1.Columns.Add("jurusan", 100, HorizontalAlignment.Left)


    End Sub
    Sub normal()
        Button1.Text = "tambah"

        Button1.Enabled = "true"

        Button2.Text = "ubah"
        Button2.Enabled = "true"

        Button3.Text = "hapus"
        Button3.Enabled = "true"

        Button4.Text = "keluar"

    End Sub

    Sub bersih()
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        ComboBox1.Text = " 06 Teknik Informatika "
    End Sub
    Sub isikombo()
        ComboBox1.Items.Add("Teknik Informatika")
        ComboBox1.Items.Add("Sistem Informatika")
        ComboBox1.Items.Add("Komputer akutansi")
        ComboBox1.Items.Add("Manajemen Informatika")
        ComboBox1.Items.Add("Teknik Komputer")


    End Sub

    Private Sub ListView1_ItemSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles ListView1.ItemSelectionChanged
        TextBox1.Text = e.Item.Text
    End Sub


    Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged

    End Sub

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox2.Focus()



        End If

    End Sub

    Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox3.Focus()

        End If
    End Sub

    Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
        If e.KeyChar = Chr(13) Then
            ComboBox1.Focus()

        End If
    End Sub

    Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
        If e.KeyChar = Chr(13) Then
            Button1.Focus()

        End If
    End Sub

   
  
   
  
   
End Class




UNTUK HASIL LEBIH JELAS SILAHKAN KLIK DISINI 
 dan untuk hasil dalam bentuk project klik disini 

 [SEMOGA BERHASIL]

0 komentar:

Posting Komentar