You are on page 1of 4

Latihan 6.

Buat Design Form Sebagai berikut:

Object Propertis Setting


Name frmhitung
Form1 Caption ..::Program Keenam::..
StartUpPostion 2 - CenterScreen
Name txtpanjang
TextBox1
Text Tulisan text1 di hapus
Name txtlebar
TextBox2
Text Tulisan text2 di hapus
Name txtluas
TextBox3
Text Tulisan text3 di hapus
TextBox4 Name txtkel
Text Tulisan text3 di hapus
Command Name cmdhitung
Button1 Caption &Hitung
Command Name cmdlagi
Button2 Caption &Lagi
Command Name cmdkeluar
Button3 Caption &Keluar
Frame1 Caption INPUT
Frame2 Caption Hasil
Private Sub cmdhitung_Click()
Dim p, l, luas, kel As Integer
p = Val(txtpanjang.Text)
l = Val(txtlebar.Text)
luas = p * l
kel = 2 * (p + l)
txtluas.Text = luas
txtkel.Text = kel
End Sub

Private Sub cmdkeluar_Click()


End
End Sub

Private Sub cmdlagi_Click()


txtpanjang.Text = ""
txtlebar.Text = ""
txtluas.Text = ""
txtkel.Text = ""
txtpanjang.SetFocus
End Sub

Private Sub txtpanjang_KeyPress(KeyAscii As Integer)


If KeyAscii = 13 Then
txtlebar.SetFocus
End If
End Sub
Latihan 7
Buat Design Form Sebagai berikut:

Object Propertis Setting


Name frmwarna
Caption ..::Program
Form1
Ketujuh::..
StartUpPostion 2 - CenterScreen
Name optmerah
OptionButoon1
Caption MERAH
Name optbiru
OptionButoon2
Caption BIRU
Name optkuning
OptionButoon3
Caption KUNING
Name opthitam
OptionButoon4
Caption HITAM
Name optputih
OptionButoon5 Caption PUTIH

Name opthijau
OptionButoon6
Caption HIJAU
Name optungu
OptionButoon7
Caption UNGU

Untuk ukuran huruf option nya juga sama tapi


berbeda nama & caption
Frame1 Caption Warna Huruf
Frame2 Caption Warna Background
Frame3 Caption Ukuran Huruf
Private Sub opt8_Click() Private Sub opthitam_Click()
Label1.FontSize = 8 Label1.ForeColor = vbBlack
End Sub End Sub

Private Sub opt14_Click() Private Sub optkuning_Click()


Label1.FontSize = 14 Label1.ForeColor = vbYellow
End Sub End Sub

Private Sub opt10_Click() Private Sub optmerah_Click()


Label1.FontSize = 10 Label1.ForeColor = vbRed
End Sub End Sub

Private Sub opt12_Click() Private Sub optputih_Click()


Me.BackColor = vbWhite
Label1.FontSize = 12
Label1.BackStyle = 0
End Sub End Sub

Private Sub optbiru_Click() Private Sub optungu_Click()


Label1.ForeColor = vbBlue Me.BackColor = vbMagenta
End Sub Label1.BackStyle = 0
End Sub
Private Sub opthijau_Click()
Me.BackColor = vbGreen
Label1.BackStyle = 0
End Sub