Contoh Program Perulangan If Then Else dan Cara Menambahkan Form Pada VB 2008
Langkah - langkah menambah form baru
-Klik Menu Project
-Pilih Add windows Form
-Pilih Windows Form
-Klik Add
Gambar 1.2 Desain Program
Kode Program
Public Class Form1
Private Sub BtnProses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BtnProses.Click
If
TxtNilai.Text >= 75 Then
TxtHasil.Text = "Lulus"
Else
TxtHasil.Text = "Gagal"
End If
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TxtHasil.Clear()
TxtNilai.Clear()
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub
End Class
Gambar 1.2 Hasil Proses
Gambar 1. 3 Tampilan Bersih
Gambar 1.4 Desain Program
Gambar 1.5 Hasil Proses
Kode Program
Public Class Form2
Private Sub BtnProses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BtnProses.Click
If
TxtNilai.Text >= 85 Then
TxtHasil.Text = "Lulus"
ElseIf
TxtNilai.Text >= 75 Then
TxtHasil.Text = "DAFTAR PENGGANTI"
Else
TxtHasil.Text = "Gagal"
End If
End Sub
Private Sub BtnBersih_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BtnBersih.Click
TxtHasil.Clear()
TxtNilai.Clear()
End Sub
Private Sub BtnTutup_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BtnTutup.Click
End
End Sub
End Class
Gambar 1.6 Tampilan Bersih
Komentar
Posting Komentar