visual basic tugas 1

Untitled-1
Private Sub cmdBersih_Click()
‘Mengosongkan isi TextBox
txtbil1.Text = “”
Txtbil2.Text = “”
txthasil.Text = “”
End Sub

Private Sub cmdHitung_Click()
‘Deklarasi Variabel Lokal
Dim a As Single
Dim b As Single
Hasil As Single

a = txtbil1.Text
b = Txtbil2.Text
Hasil = a * b
txthasil.Text = Hasil
End Sub

Private Sub cmdKeluar_Click()
‘Mengakhiri Program
End
End Sub

Private Sub Form_Load()

End Sub

TUGAS VB 2

Untitled-1UU

1. Kode Buah :

Private Sub txtkb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtnb.SetFocus

End If

End Sub

2. Nama Buah :

Private Sub txtnb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txthb.SetFocus

End If

End Sub

3. Harga Buah :

Private Sub txthb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtjb.SetFocus

End If

End Sub

4. Jumlah Beli :

Private Sub txtjb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txttb.Text = Val(txthb.Text) * (txtjb.Text)

End If

End Sub

5. Total Bayar :

Private Sub txttb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

End If

End Sub

 

6. Lagi :

Private Sub cmdlagi_Click()

txtkb.SetFocus

txtkb = “”

txtnb = “”

txthb = “”

txtjb = “”

txttb = “”

End Sub

 

7. Batal :

Private Sub cmdbatal_Click()

txtkb.SetFocus

txtkb = “”

txtnb = “”

txthb = “”

txtjb = “”

txttb = “”

End Sub

8. Keluar :

Private Sub cmdkeluar_Click()

End

End Sub

TUGAS VB 1

Untitled-1

1. NPM :

Private Sub txtnpm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub

2. Nama Mahasiswa:
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtps.SetFocus
End If
End Sub

3. Program Studi :
Private Sub txtps_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtjurusan.SetFocus
End If
End Sub

4. Jurusan :
Private Sub txtjurusan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtsemester.SetFocus
End If
End Sub

5. Semester :
Private Sub txtsemester_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
End If
End Sub

6. Lagi :
Private Sub cmdlagi_Click()
txtnpm.SetFocus
txtnpm = “”
txtnama = “”
txtps = “”
txtjurusan = “”
txtsemester = “”
End Sub

7. Batal :
Private Sub cmdbatal_Click()
txtnpm.SetFocus
txtnpm = “”
txtnama = “”
txtps = “”
txtjurusan = “”
txtsemester = “”
End Sub

8. Keluar :
Private Sub cmdkeluar_Click()
end
End Sub