Private Sub Command1_Click()
Dim harga As Currency
harga = 0
If jeniskamar(0).Value Then
harga = harga + 150000
ElseIf jeniskamar(1).Value Then
harga = harga + 250000
ElseIf jeniskamar(2).Value Then
harga = harga + 450000
End If
If fasilitas(0).Value Then
harga = harga + 50000
ElseIf fasilitas(1).Value Then
harga = harga + 75000
ElseIf fasilitas(2).Value Then
harga = harga + 100000
End If
MsgBox "harga total yang harus dibayarkan adalah" & vbNewLine & "Rp " & harga & ",-"
Dim bayar As Currency
Do
bayar = InputBox("masukkan jumlah yang anda bayarkan")
Loop Until bayar >= harga
If bayar > harga Then
MsgBox "kembalian anda : Rp " & bayar - harga & vbNewLine & "terima kasih"
Else
MsgBox "terima kasih"
End If
Call reset
End Sub
Sub reset()
Text1.Text = ""
jeniskamar(0).Value = True
Dim i As Integer
For i = 0 To 2
fasilitas(i).Value = False
Next
End Sub
Private Sub Command2_Click()
Form4.Show
Unload Me
End Sub
Private Sub Command3_Click()
End
End Sub
Showing posts with label VB. Show all posts
Showing posts with label VB. Show all posts
Friday, April 1, 2011
Digital Time
Private Sub Command1_Click()
End
End Sub
Private Sub Command3_Click()
If Command3.Caption = "&stop" Then
Command3.Caption = "&start"
Timer2.Enabled = False
Else
Command3.Caption = "&stop"
Timer2.Enabled = True
End If
End Sub
Private Sub Form_Load()
Label2.Caption = Format(Now, "DDDD, d mmmm yyyy hh:mm:ss")
End Sub
Private Sub Timer1_Timer()
Label2.Caption = Format(Now, "DDDD, d mmmm yyyy hh:mm:ss")
End Sub
Private Sub Timer2_Timer()
Dim s As String
s = Label1.Caption
s = Mid(s, 2, Len(s) - 1) & Left(s, 1)
Label1.Caption = s
End Sub
End
End Sub
Private Sub Command3_Click()
If Command3.Caption = "&stop" Then
Command3.Caption = "&start"
Timer2.Enabled = False
Else
Command3.Caption = "&stop"
Timer2.Enabled = True
End If
End Sub
Private Sub Form_Load()
Label2.Caption = Format(Now, "DDDD, d mmmm yyyy hh:mm:ss")
End Sub
Private Sub Timer1_Timer()
Label2.Caption = Format(Now, "DDDD, d mmmm yyyy hh:mm:ss")
End Sub
Private Sub Timer2_Timer()
Dim s As String
s = Label1.Caption
s = Mid(s, 2, Len(s) - 1) & Left(s, 1)
Label1.Caption = s
End Sub
Select Case
Dim NilaiTm As Integer
Dim NilaiMid As Integer
Dim NilaiFinal As Integer
Dim NilaiAkhir As Integer
Dim Grade As String
Private Sub Command1_Click()
NilaiTm = Val(Text1.Text)
NilaiMid = Val(Text2.Text)
NilaiFinal = Val(Text3.Text)
NilaiAkhir = NilaiTm * 0.2 + NilaiMid * 0.3 + NilaiFinal * 0.5
Select Case NilaiAkhir
Case Is < 55
Grade = "E"
Case 55 To 64
Grade = "D"
Case 65 To 74
Grade = "C"
Case 75 To 84
Grade = "B"
Case Else
Grade = "A"
End Select
Text4.Text = NilaiAkhir
Text5.Text = Grade
End Sub
Private Sub Command2_Click()
Form3.Show
Hide
End Sub
Private Sub Command3_Click()
End
End Sub
Dim NilaiMid As Integer
Dim NilaiFinal As Integer
Dim NilaiAkhir As Integer
Dim Grade As String
Private Sub Command1_Click()
NilaiTm = Val(Text1.Text)
NilaiMid = Val(Text2.Text)
NilaiFinal = Val(Text3.Text)
NilaiAkhir = NilaiTm * 0.2 + NilaiMid * 0.3 + NilaiFinal * 0.5
Select Case NilaiAkhir
Case Is < 55
Grade = "E"
Case 55 To 64
Grade = "D"
Case 65 To 74
Grade = "C"
Case 75 To 84
Grade = "B"
Case Else
Grade = "A"
End Select
Text4.Text = NilaiAkhir
Text5.Text = Grade
End Sub
Private Sub Command2_Click()
Form3.Show
Hide
End Sub
Private Sub Command3_Click()
End
End Sub
Form Login VB to Access
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim SQL, Pesan As String
Private Sub Command2_Click(Index As Integer)
If Text1.Text = "" Then
MsgBox "Masukkan Username dengan benar", vbInformation
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "Masukkan Password dengan benar", vbInformation
Text2.SetFocus
Exit Sub
End If
SQL = "select * from username where username='" & Text1 & "'and password='" & Text2 & "'"
Set rs = New ADODB.Recordset
rs.Open SQL, con, adOpenDynamic, adLockOptimistic, adCmdText
If Not rs.EOF Then
Text1.SetFocus
Text2.SetFocus
Else
Pesan = MsgBox("Silahkan Anda isi dengan benar", vbInformation)
Text1.SetFocus
Text2.SetFocus
Exit Sub
End If
sisgud.Show (modal)
Unload Me
End Sub
Private Sub Command1_Click(Index As Integer)
Pesan = MsgBox("Apakah Anda Ingin Keluar ?", vbYesNo + vbQuestion, "Konfirmasi Keluar")
If Pesan = vbYes Then
End
End If
End Sub
Private Sub Form_Load()
Set con = New ADODB.Connection
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\ahroihan\Documents\tes vb\db1.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
End Sub
Dim rs As New ADODB.Recordset
Dim SQL, Pesan As String
Private Sub Command2_Click(Index As Integer)
If Text1.Text = "" Then
MsgBox "Masukkan Username dengan benar", vbInformation
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "Masukkan Password dengan benar", vbInformation
Text2.SetFocus
Exit Sub
End If
SQL = "select * from username where username='" & Text1 & "'and password='" & Text2 & "'"
Set rs = New ADODB.Recordset
rs.Open SQL, con, adOpenDynamic, adLockOptimistic, adCmdText
If Not rs.EOF Then
Text1.SetFocus
Text2.SetFocus
Else
Pesan = MsgBox("Silahkan Anda isi dengan benar", vbInformation)
Text1.SetFocus
Text2.SetFocus
Exit Sub
End If
sisgud.Show (modal)
Unload Me
End Sub
Private Sub Command1_Click(Index As Integer)
Pesan = MsgBox("Apakah Anda Ingin Keluar ?", vbYesNo + vbQuestion, "Konfirmasi Keluar")
If Pesan = vbYes Then
End
End If
End Sub
Private Sub Form_Load()
Set con = New ADODB.Connection
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\ahroihan\Documents\tes vb\db1.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
End Sub
Subscribe to:
Posts (Atom)