Cara Membuat Program Pangkat dengan Visual Basic

1. Buka Visual Basic, pilih new project dan standart exe
2. Tambah kan 3label, 3 textbox, 3 command
3. Atur Property kontrol :


Kontrol
Property
Nilai
Form 1
Name
Caption
Frmpangkat
Form Bilangan Pangkat
Text 1
Name
Aligment
text
Text1
1
0
Text3
Name
Aligment
text
Text 3
1
0
Command1
Name
Caption
Cmdhitung
hitung
Command 2
Name
Caption
Cmdbatal
Batal
Command
Name
Caption
Cmdkeluar
Keluar


















4. Masukkan code program seperti dibawah ini :


Private Sub cmdbatal_Click()
Text1.Text = "0"
Text2.Text = "0"
Text3.Text = "0"
Text1.SetFocus
End Sub

Private Sub cmdhitung_Click()
Dim a, b, hasil As Integer
a = Text1.Text
b = Text2.Text
Atur Property Kontrol:
 
hasil = 1
For i = 1 To b
    hasil = hasil * a
Next i
Text3.Text = hasil
End Sub

Private Sub cmdkeluar_Click()
End
End Sub
 

Komentar

Posting Komentar

Postingan populer dari blog ini

Soal Latihan Pengantar Probabilitas

PAPER KARYA ILMIAH