2. Tambahkan 2 label, 2 text box, 1 command button, dan 1 frame, kemudian sehabis frame di tambahkan tambahkan lagi 1 label di atas frame.
3. Ubahlah propertienya, menyerupai ini :
Tool Box | Properties | Keterangan |
Form 1 | Star Up Position | Center Screen |
Command 1 | Caption | COUNT |
Label 1 | Caption | R |
Label 2 | Caption | H |
Label 3 | Caption | 0 |
Frame 1 | Caption | Result |
Text 1 | Text | (Kosong) |
Text 2 | Text | (Kosong) |
Private Sub Command1_Click()
If Command1.Caption = "COUNT" Then
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "Please, Complete the form !", vbInformation, "BLUES PEDIA"
Else
Label4.Caption = 22 / 7 * (Val(Text1) ^ 2) * Val(Text2)
Command1.Caption = "TRY AGAIN"
Text1.Enabled = False
Text2.Enabled = False
End If
ElseIf Command1.Caption = "TRY AGAIN" Then
Text1.Enabled = True
Text2.Enabled = True
Text1.Text = ""
Text2.Text = ""
Label4.Caption = ""
Text1.SetFocus
Command1.Caption = "COUNT"
End If
End Sub
5. Jika sudah, jalankan program
Coba masukan angka di text1 dan text 2, disini aku mencoba dengan angka 7 (R = jari - jari), dan 2 (H = tinggi), kemudian klik "Count", maka otomatis label 3 berisi hasil volume tabung,
R yaitu 7 maka r kuadrat = 49
H = 2
phi = 22/7, sehingga
= 22/
= 2 x 154
= 308
dan jikalau ingin mencobanya kembali, klik saja "TRY AGAIN", maka kondisinya akan menyerupai awal
Semoga bermanfaat
Comments
Posting Komentar