Anda di halaman 1dari 4

Latihan 4.

Buat Design Form Sebagai berikut:

Object Propertis Setting


Name frmhitung
Form1 Caption ..::Program Keempat::..
StartUpPostion 2 - CenterScreen
Name txtnil1
TextBox1
Text Tulisan text1 di hapus
Name xtnil2
TextBox2
Text Tulisan text2 di hapus
Name txthasil
TextBox3
Text Tulisan text3 di hapus
Command1 Name cmdtambah
Text TAMBAH
Command2 Name cmdkurang
Caption KURANG
Command3 Name cmdkali
Caption KALI
Command4 Name cmdbagi
Caption BAGI
Command5 Name cmdkeluar
Caption KELUAR

Private Sub cmdbagi_Click()


txthasil.Text = Val(txtnil1.Text) / Val(txtnil2.Text)
End Sub
Private Sub cmdkali_Click()
txthasil.Text = Val(txtnil1.Text) * Val(txtnil2.Text)
End Sub

Private Sub cmdkeluar_Click()


End
End Sub

Private Sub cmdkurang_Click()


txthasil.Text = Val(txtnil1.Text) - Val(txtnil2.Text)
End Sub

Private Sub cmdtambah_Click()


txthasil.Text = Val(txtnil1.Text) + Val(txtnil2.Text)
End Sub

Latihan 5.
Buat Design Form Sebagai berikut:

Object Propertis Setting


Name frmnilai
Form1 Caption ..::Program Kelima::..
StartUpPostion 2 - CenterScreen
TextBox1 Name txtnim
Text Tulisan text1 di hapus
Name txtnama
TextBox2
Text Tulisan text2 di hapus
Name txtkelas
TextBox3
Text Tulisan text3 di hapus
TextBox4 Name txtabsen
Text Tulisan text3 di hapus
TextBox5 Name txttugas
Text Tulisan text3 di hapus

TextBox6 Name txtuts


Text Tulisan text3 di hapus
TextBox7 Name txtuas
Text Tulisan text3 di hapus
TextBox8 Name txtrata
Text Tulisan text3 di hapus
Command1 Name cmdhitung
Text HITUNG
Command2 Name cmdbersih
Caption BERSIH
Command3 Name cmdkeluar
Caption KELUAR

Private Sub cmdbersih_Click()


txtnim.Text = ""
txtnama.Text = ""
txtkelas.Text = ""
txtabsen.Text = ""
txttugas.Text = ""
txtuts.Text = ""
txtuas.Text = ""
txtrata.Text = ""
txtnim.SetFocus
End Sub

Private Sub cmdhitung_Click()


txtrata = Val((10 / 100 * txtabsen.Text) + (20 / 100 * txttugas.Text) + (30 /
100 * txtuts.Text) + (40 / 100 * txtuas.Text))
End Sub

Private Sub cmdkeluar_Click()


End
End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
txtkelas.SetFocus
End If
End Sub

Private Sub txtkelas_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
txtabsen.SetFocus
End If
End Sub

Private Sub txtabsen_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
txttugas.SetFocus
End If
End Sub

Private Sub txttugas_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
txtuts.SetFocus
End If
End Sub

Private Sub txtuts_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
txtuas.SetFocus
End If
End Sub

Private Sub txtnim_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub

Anda mungkin juga menyukai