Hemmm......kuliah cepet juga ea....minggu depan udah uts nie....SEMANGAT!!!!
dari pada nganggur posting pelajaran minggu kemaren dech.....
Minggu lalu pak dosen ngajarin kita buat bermain - main dengan button, bikin button aktif g aktif, yang seru lagi beliau ngedekte, jadi cuma pakek arahan, dosennya muter kita yang kerja.....susah susah gampang sich, tapi seru ^_^
Nie desain programnya :
Aku kasih koding lengkapnya aja ea..... , :
Public Class Form1
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Call IsiCombo() ''mengaktifkan isi combo
Call Bersih()
End Sub
Sub IsiCombo()
ComboBox1.Items.Add("06 Teknik Informatika")
ComboBox1.Items.Add("07 sistem Informasi")
ComboBox1.Items.Add("26 Management Informasi")
ComboBox1.Items.Add("67 Komputer Akutansi")
ComboBox1.Items.Add("05 Teknik Komputer")
End Sub
Sub Bersih() '' Pilihan awal sebagai default= saat mulai jadi tampilan awal
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox1.Text = "06 Teknik Informatika"
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
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"
Button2.Enabled = False ''enable berfungsi aktif dan tidak aktif; true = aktif ;false =tidak
Button3.Enabled = False
Button4.Text = "Batal"
TextBox1.Focus() ''kursor akan lari ke textbox1
Else
ListBox1.Items.Add(Trim(TextBox1.Text) + "" + Trim(TextBox2.Text) + "" + Trim(TextBox3.Text) + "" + Trim(TextBox4.Text) + "" + Trim(ComboBox1.Text) + "")
''Trims = menghilangkan spasi
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
''button 4 untuk kluar atau batal
If Button4.Text = "Keluar" Then
Me.Close() ''menutup form diri sendiri secara otomatis
Else
Call Bersih()
Call Normal()
End If
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"
TextBox1.Focus()
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.Enabled = True
Button1.Text = "Tambah"
Button1.Enabled = False
Button3.Text = " Hapus"
Button3.Enabled = False
Button4.Text = "Batal"
TextBox1.Focus()
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Button3.Text = "Hapus" Then
Button1.Enabled = False
Button2.Enabled = False
Button4.Text = "Batal"
Button3.Text = "Ok"
End If
End Sub
End Class
Udah ada keteranganya kan, klon liat doank g akan ngerti, coba dech dipraktekin asyik.....
Klo ada yang mau nambahin boleh bgt tuch.....Ditunggu ea......^_^
Tidak ada komentar:
Posting Komentar