Punya Account Blogger?
Posted by Sofyan SOX on Selasa, 20 April 2010 in


Dim jumlah, index As Byte

Sub tanggal()
Dim hari(7) As String
Dim bulan(12) As String

hari(1) = "Minggu"
hari(2) = "Senin"
hari(3) = "Selasa"
hari(4) = "Rabu"
hari(5) = "Kamis"
hari(6) = "Jum'at"
hari(7) = "Sabtu"

bulan(1) = "Januari"
bulan(2) = "Februari"
bulan(3) = "Maret"
bulan(4) = "April"
bulan(5) = "Mei"
bulan(6) = "Juni"
bulan(7) = "Juli"
bulan(8) = "Agustus"
bulan(9) = "September"
bulan(10) = "Oktober"
bulan(11) = "Nopember"
bulan(12) = "Desember"

har = Weekday(Date)
tgl = Day(Date)
bul = Month(Date)
thn = Str(Year(Date))

Text1.Text = hari(har) & " , " & Str(tgl) & " - " & bulan(bul) & " - " & thn



End Sub
Sub kosong()
Dim x As Control
For Each x In Me
If TypeOf x Is TextBox Then x.Text = ""
If TypeOf x Is ComboBox Then x.Text = ""
Next x
Call tanggal
cbjenis.SetFocus
End Sub
Private Sub cbjenis_Click()
If cbjenis.Text = "ATK" Then
txtjenis.Text = "Alat Tulis Kantor"
Else
txtjenis.Text = "Alat Tulis Gambar"
End If

End Sub

Private Sub cbnama_Click()
If cbjenis.Text = "ATK" Then
If cbnama.Text = "01" Then
txtnama.Text = "Kertas"
ElseIf cbnama.Text = "02" Then
txtnama.Text = "Pulpen"
Else
txtnama.Text = "Tinta"
End If
Else
If cbnama.Text = "01" Then
txtnama.Text = "Spidol"
ElseIf cbnama.Text = "02" Then
txtnama.Text = "Crayon"
Else
txtnama.Text = "Cat Air"
End If
End If

End Sub

Private Sub Command1_Click()
jumlah = jumlah + 1
indeks = jumlah

fgdata.Row = jumlah
fgdata.Col = 0
fgdata.Text = Trim(cbjenis.Text + cbnama.Text + cbno.Text)

fgdata.Col = 1
fgdata.Text = Trim(txtjenis.Text)

fgdata.Col = 2
fgdata.Text = Trim(txtnama.Text)

fgdata.Col = 3
fgdata.Text = Trim(txtstok.Text)

fgdata.Col = 4
fgdata.Text = Trim(Text1.Text)

fgdata.AddItem " "

kosong

End Sub

Private Sub Form_Initialize()
fgdata.Row = 0

fgdata.Col = 0
fgdata.Text = "Kode Barang"

fgdata.Col = 1
fgdata.Text = "Jenis Barang"

fgdata.Col = 2
fgdata.Text = "Nama Barang"

fgdata.Col = 3
fgdata.Text = "Stok"

fgdata.Col = 4
fgdata.Text = "Tanggal"

jumlah = 0
End Sub

Private Sub Form_Load()
cbjenis.AddItem "ATK"
cbjenis.AddItem "ATG"

cbnama.AddItem "01"
cbnama.AddItem "02"
cbnama.AddItem "03"

For x = 1 To 100
cbno.AddItem x
Next

Call tanggal

End Sub
0 Responses to “Pengenalan Array & Flex Grid”:

Posting Komentar