Penerapan Komputer

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Latihan 1

Txtsisa.Text = Val(txtkasmasuk.Text) - Val(txtkaskeluar.Text)

Public Class Form1


Friend WithEvents bttampilan As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Private Sub bttampilkan_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bttampilkan.Click
MsgBox("Tahun : " & Txttahun.Text & vbNewLine & _
"Bulan : " & Txtbulan.Text & vbNewLine & _
"Tanggal : " & Txttanggal.Text & vbNewLine & _
"kas Masuk : " & txtkasmasuk.Text & vbNewLine & _
"kas Keluar : " & txtkaskeluar.Text & vbNewLine & _
"Sisa : " & Txtsisa.Text & vbNewLine)
End Sub
Private Sub bthapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles bthapus.Click
Txttahun.Clear()
Txtbulan.Clear()
Txttanggal.Clear()
txtkasmasuk.Clear()
txtkaskeluar.Clear()
Txtsisa.Clear()

Latihan 4
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
If TextBox1.Text = "cakra lagawa" And TextBox2.Text = "cahyadi gila" Then
MsgBox("anda berhasil login", vbOKOnly, "info")

Else
MsgBox("Anda kurang beruntung, coba lagi tahun depan!!", vbOKOnly, "peringatan!")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Close()
End Sub
End Class

Latihan 5
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim ANGKA As Integer
Dim hasil As String
Dim i As Byte
If ComboBox1.Text = "bilangan ganjil" Then
For i = 1 To Val(TextBox1.Text) Step 2
ANGKA = ANGKA + i
hasil = hasil & " " & i
Next
Label3.Text = hasil
TextBox2.Text = ANGKA
ElseIf ComboBox1.Text = "bilangan genap" Then
For i = 2 To Val(TextBox1.Text) Step 2
ANGKA = ANGKA + i
hasil = hasil & " " & i
Next
Label3.Text = hasil
TextBox2.Text = ANGKA
End Sub

Latihan 3
Public Class Form1
Dim angkapertama As Integer
Dim angkakedua As Integer
Dim Hitung As String
Dim Daftar As String
Dim Keluar As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
' membuat program hitung rata-rata
End Sub
Private Sub btnhitung_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
btnhitung.Click
'inisialisasikan tombol hitung
txthasil.Text = txthasil.Text & Hitung
End Sub
Private Sub btnkeluar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
btnkeluar.Click
txthasil.Text = txthasil.Text & Keluar
End Sub
Private Sub btndaftar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
btndaftar.Click
txthasil.Text = txthasil.Text & Daftar
MessageBox.Show("Silahkan kembali mengecek jawaban anda", vbOK, "Pesan")
End Sub
End Class

You might also like