Membuat aplikasi sederhana VB 6 (Menghitung balok)
Membuat aplikasi sederhana VB 6 (Program perhitungan)
1. Buatlah
form dengan beberapa object seperti di bawah ini
2. Setiap object tentukan property masing
masing.
Double click pada command “Exit”, dan isikan code list seperti dibawah :
Berikut output dari program diatas :
No
|
Object
|
Properties
|
Value
|
1
|
Form1
|
Caption
startupPosition
|
hitung_balok
2-CenterScreen
|
2
|
Label1
|
Caption
BackStyle
|
Panjang
0 – Tranparent
|
3
|
Label2
|
Caption
BackStyle
|
Lebar
0 – Tranparent
|
4
|
Label3
|
Caption
BackStyle
|
Tinggi
0 – Tranparent
|
5
|
Label4
|
Caption
BackStyle
|
Volume
0 – Tranparent
|
6
|
Label5
|
Caption
BackStyle
|
Luas Permukaan
0 – Tranparent
|
7
|
Text1
|
Name
Text
|
Text_panjang
<kosong>
|
8
|
Text2
|
Name
Text
|
Text_lebar
<kosong>
|
9
|
Text3
|
Name
Text
|
Text_tinggi
<kosong>
|
10
|
Text4
|
Name
Text
|
Text_volum
<kosong>
|
11
|
Text5
|
Name
Text
|
Text_lp
<kosong>
|
12
|
Command1
|
Name
Caption
|
Cmd_hitung
Hitung
|
13
|
Command2
|
Name
Caption
|
Cmd_exit
Exit
|
Sehingga form terlihat seperti di bawah ini
3. List
Code command
Double
click pada command “hitung”, dan isikan code list seperti dibawah ini :
Private
Sub cmd_hitung_Click()
Dim P, L, T, V, LP As Integer
P = CSng(Text_panjang.Text)
L = CSng(Text_lebar.Text)
T = CSng(Text_tinggi.Text)
V = P * L * T
LP = 2 * (P + L + T)
Text_volume.Text = CStr(V)
Text_lp.Text = CStr(LP)
End Sub
|
Double click pada command “Exit”, dan isikan code list seperti dibawah :
Private
Sub cmd_exit_Click()
Unload Me
End Sub
|
Berikut output dari program diatas :
-- Thanks and Regards --
By : Hendri Pratama
17 April 2014