Minggu, 09 Desember 2012

SIMULASI PENGISIAN BBM


download : http://downloads.ziddu.com/download/23940199/SIMULASI-BBM.rar.html
 Coding :
Option Explicit
Private hasil As Double
Private Const opNol = 0
Private Const opTambah = 1
Private Const opKurang = 2
Private Const opKali = 3
Private Const opBagi = 4
Private operator As Integer
Private NilaiBAru As Boolean
im Jam As Integer, Menit As Integer, Detik As Integer, mDetik As Integer
D
Private Sub haus()
End Sub
Private Sub Command11PlusMinus_Click()
If NilaiBAru Then
Text1Display.Text = "-"
ElseIf Left$(Text1Display.Text, 1) = "-" Then
Text1Display.Text = Right$(Text1Display.Text, 2)
Else
Text1Display.Text = "-" & Text1Display.Text
End If
End Sub
Private Sub Command11_Click()
End Sub
Private Sub Command10_Click()
ue
End Sub
Private Sub alih_Click()
Timer2.Enabled = False
MsgBox ("BENSIN ANDA TELAH DIISI"), vbInformation
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Command10Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub

Private Sub Command12Koma_Click()
If InStr(Text1Display.Text, ".") Then
Beep
Else
If NilaiBAru Then
Text1Display.Text = "."
NilaiBAru = False
Else
Text1Display.Text = Text1Display.Text & "."
End If
End If

End Sub

Private Sub Command13Operator_Click(Index As Integer)
Command19SamaDengan_Click
operator = Index
NilaiBAru = True
End Sub

Private Sub Command14_Click()
Image3.Visible = True
Image4.Visible = False


End Sub

Private Sub Command14Operator_Click(Index As Integer)
Command19SamaDengan_Click
operator = Index
NilaiBAru = True
End Sub

Private Sub Command15_Click()
Image4.Visible = True
Image3.Visible = False
Image5.Visible = False
Command1.Visible = False
Command3.Visible = False
jalan.Visible = True
stopp.Visible = True
ju.Visible = False
mun.Visible = False
End Sub

Private Sub Command15Operator_Click(Index As Integer)
Picture1.Visible = True
Picture3.Visible = False
Text1.Text = "0"
Command4(0).Visible = True
Command5.Visible = False

End Sub

Private Sub Command16Operator_Click()
End Sub

Private Sub Command17ClearEntry_Click()

hasil = 0
operator = opNol
End Sub
Private Sub Command18Clear_Click()
Text1Display.Text = ""
Picture3.Visible = True
Picture4.Visible = True
Timer2.Enabled = False
Command6.Caption = "Start"
Label8.Caption = "00 : 00 : 00,00"
Jam = 0
Menit = 0
Detik = 0
mDetik = 0
End Sub

Private Sub Command19SamaDengan_Click()
Dim hasilbaru As Double
If Text1Display.Text = "" Then
hasilbaru = 0
Else
hasilbaru = CDbl(Text1Display.Text)
End If
Select Case operator
Case opNol
hasil = hasilbaru
Case opTambah
hasil = hasil + hasilbaru
Case opKurang
hasil = hasil - hasilbaru
Case opKali
hasil = hasil * hasilbaru
Case opBagi
'Tidak bisa dibagi nol
If hasilbaru = 0 Then
MsgBox "Tidak bisa dibagi 0", vbOKOnly + vbCritical, "Kalkulator Error"
Call Command18Clear_Click
Else
hasil = hasil / hasilbaru
End If
End Select
operator = opNol
NilaiBAru = True
Text1Display.Text = Format$(hasil)
End Sub

Private Sub Command1Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub

Private Sub Command2_Click()
Command5.Visible = True
Command4(0).Visible = False
Picture2(1).Visible = True
Picture4.Visible = False
Text2.Text = "0"

End Sub

Private Sub Command2Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub

Private Sub Command3_Click()
Timer1.Enabled = False


End Sub

Private Sub Command3Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub
Sub rp()
Text1.Text = Text1.Text + 20
End Sub
Sub ltr()
Text2.Text = Text2.Text + 0.01
End Sub

Private Sub Command4_Click(Index As Integer)
Text1.Text = Text1.Text + 20
Dim a As Integer
a = Val(Text1.Text)
Text2.Text = a / 4500

End Sub

Private Sub Command4Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub

Private Sub Command5_Click()
Text2.Text = Text2.Text + 0.01
Dim b As Single
b = Val(Text2.Text)
Text1.Text = 4500 * b
End Sub

Private Sub Command5Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub


Private Sub Command6_Click()




Timer3.Enabled = True

If Command6.Caption = "Start" Then
Label9.Caption = Format(Time(), "hh:mm:ss")
Command6.Caption = "Stop"
Timer2.Enabled = True
Command7.Enabled = False
ElseIf Command6.Caption = "Stop" Then
Label10.Caption = Format(Time(), "hh:mm:ss")
Command6.Caption = "Start"
Label11.Caption = Format((CDate(Label10.Caption) - CDate(Label9.Caption)), "hh:mm:ss")
Command6.Enabled = False
Command7.Enabled = True
Timer2.Enabled = False
End If

End Sub

Private Sub Command6Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub

Private Sub Command7_Click()
Label9.Caption = "00:00:00"
Label10.Caption = "00:00:00"
Label11.Caption = "00:00:00"

Timer2.Enabled = False

Command6.Enabled = True
Label8.Caption = "00 : 00 : 00,00"
Jam = 0
Menit = 0
Detik = 0
mDetik = 0
End Sub

Private Sub Command7Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub

Private Sub Command8_Click()



End Sub

Private Sub Command9_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub

Private Sub Command8Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub

Private Sub Command9Angka_Click(Index As Integer)
If NilaiBAru Then
Text1Display.Text = Format$(Index)
NilaiBAru = False
Else
Text1Display.Text = _
Text1Display.Text & Format$(Index)
End If
End Sub


Private Sub edwin_Click()
Image5.Visible = True
Image4.Visible = False
Image3.Visible = False
Command1.Visible = False
Command3.Visible = False
jalan.Visible = False
stopp.Visible = False
ju.Visible = True
mun.Visible = True
End Sub

Private Sub Form_Click()
Form4.Show
End Sub

Private Sub Form_Load()
Command4(0).Visible = False
Command5.Visible = False
Label8.Caption = "00 : 00 : 00,00"
Timer1.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = False
Image3.Visible = False
Image4.Visible = False

jalan.Visible = False
stopp.Visible = False

Command1.Visible = False
Command3.Visible = False

ju.Visible = False
mun.Visible = False
End Sub

Private Sub motor_Click()

End Sub

Private Sub hitung_Click()
motor.Show

End Sub

Private Sub jalan_Click()
Timer4.Enabled = True
End Sub

Private Sub ju_Click()
Timer5.Enabled = True
End Sub

Private Sub keluar_Click()
End
End Sub

Private Sub mob_Click()
Image3.Visible = True
Image4.Visible = False
Image5.Visible = False
jalan.Visible = False
stopp.Visible = False
Command1.Visible = True
Command3.Visible = True
ju.Visible = False
mun.Visible = False
End Sub

Private Sub stop_Click()
Timer4.Enabled = False
End Sub

Private Sub mun_Click()
Timer5.Enabled = False
End Sub

Private Sub stopp_Click()
Timer4.Enabled = False
End Sub

Private Sub Text1_Change()
If Text1.Text = Text1Display.Text Then
Command4(0).Visible = False
MsgBox "ANDA TELAH MENGISI BENSIN", vbInformation
alih.SetFocus
End If

End Sub

Private Sub Text1Display_Change()
Text1Display.SelStart = Len(Text1Display.Text)
End Sub

Private Sub Text1Display_GotFocus()
Text1Display_Change
End Sub

Private Sub Text1Display_KeyPress(KeyAscii As Integer)
Dim ch As String
ch = Chr$(KeyAscii)
Select Case ch
Case "0"














0
Case "1"


1
Case "2"
2
Case "3"
3
Case "4"
4
Case "5"
5
Case "6"
6
Case "7"
7
Case "8"
8
Case "9"
9
Case "*", "x", "X"

Case "+"

Case vbCrLf, vbCr, "="

Case "-"

Case "."

Case "/"

Case "C", "c"

End Select
KeyAscii = 0
End Sub

Private Sub Text1Display_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyNumpad0
0
Case vbKeyNumpad1
1
Case vbKeyNumpad2
2
Case vbKeyNumpad3
3
Case vbKeyNumpad4
4
Case vbKeyNumpad5
5
Case vbKeyNumpad6
6
Case vbKeyNumpad7
7
Case vbKeyNumpad8
8
Case vbKeyNumpad9
9
Case vbKeyMultiply

Case vbKeyAdd

Case vbKeySeparator

Case vbKeySubtract

Case vbKeyDivide

Case vbKeyDecimal

Case vbKeyBack, vbKeyDelete
hapus
End Select
KeyCode = 0
End Sub

Private Sub Text2_Change()

If Text2.Text = Text1Display.Text Then
Command5.Visible = False
MsgBox "ANDA TELAH MENGISI BENSIN", vbInformation
alih.SetFocus

End If

End Sub

Private Sub Timer1_Timer()
Dim x As Integer

x = Image3.Left - 100
If Image3.Left <= -5500 Then
Image3.Left = 16110
Else
Image3.Left = x
End If


End Sub

Private Sub Timer2_Timer()
mDetik = mDetik + 5
If mDetik = 100 Then
mDetik = 0
       
Detik = Detik + 1
If Detik = 60 Then
Detik = 0
           
Menit = Menit + 1
If Menit = 60 Then
Menit = 0
Jam = Jam + 1
End If
           
End If
End If
   
Label8.Caption = Format(Jam, "00") & " : " & Format(Menit, "00") & " : " & Format(Detik, "00") & "," & Format(mDetik, "00")

End Sub

Private Sub Timer3_Timer()
Form1.Caption = "Sekarang Jam : " & FormatDateTime(Time(), vbLongTime)
End Sub

Private Sub Timer4_Timer()
Dim z As Integer

z = Image4.Left - 100
If Image4.Left <= -5500 Then
Image4.Left = 16110
Else
Image4.Left = z
End If

End Sub

Private Sub Timer5_Timer()
Dim ww As Integer

ww = Image5.Left - 100
If Image5.Left <= -5500 Then
Image5.Left = 16110
Else
Image5.Left = ww
End If
End Sub


JIKA  ANDA BERMINAT  UNTUK MENGEMBANGKAN PROGRAMNYA HUB.. wildamoktofiel@gmail.com