Archive

Archive for September, 2008

Argument Command Line

September 22, 2008 programmervb Leave a comment

Private Sub Form_Load()

Dim strCmd as String

strCmd=Command$() ‘get argument from command line

If InStrB (strCmd, “-status MAX”) > 0 then

Me.WindowState=2

Me.Caption=”Argument:” & strCmd

Else

Me.WindowState=0

End if

End Sub

Point Of Sales Simple

September 22, 2008 programmervb Leave a comment

Option Explicit

Private Sub cmbSatuan_Click()
Select Case cmbSatuan.ListIndex
Case 0:
lblSatuan.Caption = “Person”
Case 1:
lblSatuan.Caption = “Cups”
Case 2:
lblSatuan.Caption = “Pcs”
End Select

End Sub

Private Sub cmdHitung_Click()
Dim SubTotal As Double
Dim Discount As Double
Dim Total As Double

If (txtNamaBarang.Text = “”) Or (txtJumlah.Text = “”) Or _
(txtHarga.Text = “”) Then
If txtNamaBarang.Text = “” Then
MsgBox “Insert Item!”, vbOKOnly, “Informasi”
txtNamaBarang.SetFocus
End If

If txtJumlah.Text = “” Then
MsgBox “Total is Empty!”, vbOKOnly, “Informasi”
txtJumlah.SetFocus
End If

If txtHarga.Text = “” Then
MsgBox “Price is Empty!”, vbOKOnly, “Informasi”
txtHarga.SetFocus
End If
Else
SubTotal = txtJumlah.Text * txtHarga.Text

Discount = 0
If Month(Date) = 6 Then
If Day(Date) >= 20 And Day(Date) <= 30 Then
If SubTotal >= 50000 Then
Discount = 10 / 100 * SubTotal
End If
End If
End If

Total = SubTotal – Discount

lblSubtotalRp.Caption = SubTotal
lblDiscountRp.Caption = Discount
lblTotalRp.Caption = Total
End If

End Sub

Private Sub Form_Load()
lblTanggal.Caption = “Date: ” & Date
cmbSatuan.AddItem “Foods”
cmbSatuan.AddItem “Drinks”
cmbSatuan.AddItem “Snack”
cmbSatuan.ListIndex = 0
End Sub

Get Information File With FSO

September 22, 2008 programmervb Leave a comment

dim fso as new scripting.fileSystemObject

dim fld as scripting.folder

set fld=fso.getfolder(“C:\tmp”)

dim fil as scripting.filefor each fil in fld.files

me.lst.AddItem (fil.name)

next fil

set fso=nothing

File Size

September 22, 2008 programmervb Leave a comment

Private Sub cmdShowFileSize_Click()
Dim strOldFile As String
Dim strOldSize As String
Dim strMyDir As String
Dim strMyFile As String

strMyDir = “c:\windows\desktop”
strMyFile = “readme.txt”

strOldFile = strMyDir & “\” & strMyFile
strOldSize = FileLen(strOldFile)

lblFileSize.Caption = “The file ” & strOldFile & ” is ” & _
Format(strOldSize, “#,##0″) & ” bytes in size.”

End Sub

Categories: Source Code Tags: