Printahnya
yaitu:
Public Class Form1
Private Sub
NPM_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
NPM.SelectedIndexChanged
If NPM.Text = "1011566"
Then Nama.Text = "acingApuk"
If NPM.Text = "101102"
Then Nama.Text = "salsa"
If NPM.Text = "1011533"
Then Nama.Text = "sunika"
End Sub
Private Sub
BtnKeluar_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
BtnKeluar.Click
End
End Sub
Private Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
NPM.Items.Add("1011566")
NPM.Items.Add("101102")
NPM.Items.Add("1011533")
MataKuliah.Items.Add("kalkulus")
MataKuliah.Items.Add("B.indo")
MataKuliah.Items.Add("Fisika")
MataKuliah.Items.Add("visual")
End Sub
Private Sub
BtnHapus_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
BtnHapus.Click
NPM.Text = ""
Nama.Text = ""
MataKuliah.Text = ""
Nilai.Text = ""
Keterangan.Text = ""
End Sub
Private Sub
btnproses_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnproses.Click
Dim xket As String
xket = "gagal"
If Nilai.Text >= 50 Then
xket = "lulus"
Keterangan.Text = xket
End Sub
End Class
Contoh program looping (perulangan)
Printahnya yaitu:
Public Class Form1
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim z As Byte
ListBox1.Items.Clear()
z = 1
Do Until z = 11
ListBox1.Items.Add(z)
z = z + 1
Loop
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim x As Byte
x = 1
Do While x <= 10
ListBox2.Items.Add(x)
x = x + 1
Loop
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim y As Integer
For y =
20 To 1 Step -5
ListBox3.Items.Add(y & "Y")
Next
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim b As Byte
b = 1
While b
<= 10
ListBox4.Items.Add(b)
b = b + 1
End While
End Sub
Private Sub Button5_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
Dim a As Integer
For a =
1 To 4
ListBox5.Items.Add("THE GREEN CAMPUZ")
Next
End Sub
Private Sub BtnKeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BtnKeluar.Click
End
End Sub
End Class
Tidak ada komentar:
Posting Komentar