Sabtu, 16 April 2011

Public Class Form1

Dim isitext(4) As String
Dim mListItem As ListViewItem


Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Call bersih()
Call setTampilan()
End Sub

Sub bersih()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub

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"
Button4.Text = "Batal"
TextBox1.Focus()
Else
isitext(0) = TextBox1.Text
isitext(1) = Trim(TextBox2.Text)
isitext(2) = Trim(TextBox3.Text)
isitext(3) = Microsoft.VisualBasic.Right((ComboBox1.Text), 12)

mListItem = New ListViewItem(isitext)
ListView1.Items.Add(mListItem)
Call bersih()
TextBox1.Focus()

End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If Button4.Text = "Keluar" Then
Me.Close()
Else
Call bersih()
Call normal()
End If
End Sub
Sub normal()
Button1.Text = "Tambah"
Button1.Enabled = True
Button4.Text = "Keluar"
End Sub

Sub setTampilan()
ListView1.View = View.Details
ListView1.Columns.Add("NPM", 100, HorizontalAlignment.Center)
ListView1.Columns.Add("Nama", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Alamat", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Jurusan", 100, HorizontalAlignment.Left)
End Sub

End Class

Tidak ada komentar:

Posting Komentar