Rabu, 31 Desember 2008

Fungsi IF Dalam VB.Net ( IF functions In VB.Net )


Buatlah sebuah project dan Form. Dalam form tambahkan tujuh label,dua textbox, satu combobok, dan dua commandbuton.setelah itu beri nama di properties label 1 text = Nis, label 2 text = Nama, label 3 text = Kelas, label 4 text = Wali kelas, label 5 text = Kapasitas, label 6 text = kosongkan (beri tujuh spasi di text) borderstyle=fixedsingle, label 7 text = Kosongkan (beri tujuh spasi di text) borderstyle=fixedsingle, Commbobox1 item = xa xb xc, ommandbuton1 text=Simpan,dan ommandbuton2 text=Keluar
Ketikan coding dibawah ini
Private Sub commandbuton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsimpan.Click
If rdlaki.Checked Then
jenkel = "Laki-Laki"
ElseIf rdperempuan.Checked Then
jenkel = "Perempuan"
Else
jenkel = "Blm dipilih"
End If

data = "Nama : " + txtnama.Text + Chr(13) + "Tempat : " + txttempat.Text + Chr(13) + _
"Tgl Lahir : " + cmbtgl.Text + "-" + cmbbln.Text + "-" + cmbthn.Text + Chr(13) + _
"Alamat : " + txtalamat.Text + Chr(13) + "Jenis Kelamin : " + jenkel

MsgBox(data, MsgBoxStyle.Information, "Pesan")

End Sub

Private Sub commbobox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbkelas.SelectedIndexChanged
If cmbkelas.Text = "XA" Then
wali = "Darsini"
kapasitas = "40"
ElseIf cmbkelas.Text = "XB" Then
wali = "Waluyo"
kapasitas = "30"
Else
wali = "Paijo"
kapasitas = "20"
End If
lblwalikelas.Text = wali
lblkapasitas.Text = kapasitas
End Sub



Create a project and Form. Add in the form of seven labels, two textbox, one combobok, and two commandbuton.setelah was named properties in the label text = 1 Nis, label 2 text = name, label text = Class 3, 4 label text = Guardian class, text label 5 = Capacity, 6 label text = empty (give seven spaces in the text) borderstyle = fixedsingle, label text = Clear 7 (give seven spaces in the text) borderstyle = fixedsingle, Commbobox1 item = xa xb xc, text = ommandbuton1 Save, and text ommandbuton2 = Exit
When coding below
Private Sub commandbuton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsimpan.Click
If rdlaki.Checked Then
jenkel = "Laki-Laki"
ElseIf rdperempuan.Checked Then
jenkel = "Perempuan"
Else
jenkel = "Blm dipilih"
End If

data = "Nama : " + txtnama.Text + Chr(13) + "Tempat : " + txttempat.Text + Chr(13) + _
"Tgl Lahir : " + cmbtgl.Text + "-" + cmbbln.Text + "-" + cmbthn.Text + Chr(13) + _
"Alamat : " + txtalamat.Text + Chr(13) + "Jenis Kelamin : " + jenkel

MsgBox(data, MsgBoxStyle.Information, "Pesan")

End Sub

Private Sub commbobox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbkelas.SelectedIndexChanged
If cmbkelas.Text = "XA" Then
wali = "Darsini"
kapasitas = "40"
ElseIf cmbkelas.Text = "XB" Then
wali = "Waluyo"
kapasitas = "30"
Else
wali = "Paijo"
kapasitas = "20"
End If
lblwalikelas.Text = wali
lblkapasitas.Text = kapasitas
End Sub

Stumble
Delicious
Technorati
Twitter
Digg
Facebook
Reddit

0 Comments:

Posting Komentar