2. Tambahkan 2 label, 2 text box, 1 command button, dan 1 frame, kemudian sesudah frame di tambahkan tambahkan lagi 1 label di atas frame.
3. Ubahlah propertienya, ibarat ini :
Tool Box | Properties | Keterangan |
Form 1 | Star Up Position | Center Screen |
Command 1 | Caption | COUNT |
Label 1 | Caption | R |
Label 2 | Caption | T |
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
Label3.Caption = 1 / 3 * 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
R yaitu 7 maka r kuadrat = 49
T = 21
phi = 22/7, sehingga
= 1/3 x 22/
= 7 x 154
= 1078
dan kalau ingin mencobanya kembali, klik saja "TRY AGAIN", maka kondisinya akan ibarat awal
Semoga bermanfaat
Comments
Posting Komentar