Artikel, Program Gratis, Konsultasi & Pemesanan Program…

Belajar VB n Persiapan TA…

Membuat Kalkulator

Mau dibilang sederhana., tapi banyak bgt penggunaan objeknya. he…

intinya., Mudah Belajar VB mau menyuguhkan program kalkulator yang hampir persis sama kalkulator bawaan Windows.

Form Kalkulator

Form Kalkulator

Yuks kita mulai…🙂 :


– Buat 16 Command Button yg name n captionnya:
nol/0, satu/1, dua/2, tiga/3, empat/4, lima/5, enam/6, tujuh7, delapan/8, sembilan/9
Clear/c, bagi/(/), kali/x. kurang/- tambah/+, samadengan/=

– Buat 4 Option:
optionbagi, optionkali, optionkurang, optiontambah (tidak terlihat di gambar karena disembunyikan)

– Buat 2 textbox., text1 & text2

dan ketik listingnya seperti dibawah ini:

—————————————————————-
Private Sub Form_Activate()
kondisi_a
End Sub
Sub kondisi_a()
Text1 = “”
Text2 = “”
Text1.Locked = True
Text2.Locked = True
Optionbagi.Value = 0
Optionkali.Value = 0
Optionkurang.Value = 0
Optiontambah.Value = 0
Text1.Visible = True
Text2.Visible = False
ground.SetFocus
End Sub
Private Sub Clear_Click()
kondisi_a
End Sub
Private Sub satu_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then ‘(biru ke biru ditulis dalam satu baris)
Text2 = Text2 + “1”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “1”
End If
ground.SetFocus
End Sub
Private Sub dua_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “2”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “2”
End If
ground.SetFocus
End Sub
Private Sub tiga_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “3”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “3”
End If
ground.SetFocus
End Sub
Private Sub empat_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “4”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “4”
End If
ground.SetFocus
End Sub
Private Sub lima_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “5”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “5”
End If
ground.SetFocus
End Sub
Private Sub enam_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “6”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “6”
End If
ground.SetFocus
End Sub
Private Sub tujuh_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “7”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “7”
End If
ground.SetFocus
End Sub
Private Sub delapan_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “8”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “8”
End If
ground.SetFocus
End Sub
Private Sub sembilan_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “9”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “9”
End If
ground.SetFocus
End Sub
Private Sub nol_Click()
If Optionbagi.Value = True Or Optionkali.Value = True Or Optionkurang.Value = True Or Optiontambah.Value = True Then
Text2 = Text2 + “0”
Text1.Visible = False
Text2.Visible = True
Else
Text1 = Text1 + “0”
End If
ground.SetFocus
End Sub
Private Sub Optionkurang_Click()
Optionkurang.Value = 1
End Sub
Private Sub cmdbagi_Click()
Optionbagi.Value = 1
End Sub
Private Sub cmdkali_Click()
Optionkali.Value = 1
End Sub
Private Sub cmdkurang_Click()
Optionkurang.Value = 1
End Sub
Private Sub cmdtambah_Click()
Optiontambah.Value = 1
End Sub
Private Sub samadengan_Click()
If Optionbagi.Value = True Then
Text1.Visible = True
Text2.Visible = False
Text1 = Text1 / Text2
Text2 = “”
ElseIf Optionkali.Value = True Then
Text1.Visible = True
Text2.Visible = False
Text1 = Text1 * Text2
Text2 = “”
ElseIf Optionkurang.Value = True Then
Text1.Visible = True
Text2.Visible = False
Text1 = Text1 – Text2
Text2 = “”
ElseIf Optiontambah.Value = True Then
Text1.Visible = True
Text2.Visible = False
Text1 = Val(Text1) + Val(Text2)
Text2 = “”
End If
End Sub

—————————————————————-
 

Mudah bukan???😀
Selamat mencoba ya…🙂

<<< Back To Index

Tags:
HOME
TOOL SYSTEM
PROGRAM GRATIS
KUMPULAN PROGRAM
PEMESANAN PROGRAM
HUBUNGI KAMI

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: