Saturday, October 3, 2009

Clear Recent File(s)



Oke, dengan vb kita bisa membersihkan daftar file-file yang kita buka. Karena windows secara default menyimpan daftar file tsb. kalo kita klik start>Documents, maka akan tampil semua file yang udah kita buka.

kalo mau delete...ngapain cape-cape, nih kode vb-nya...


Private Declare Sub SHAddToRecentDocs Lib "shell32.dll" _
(ByVal uFlags As Long, ByVal PV As String)


Private Sub Command1_Click()
   ClearDocumentsMenu
   MsgBox "Sudah ter-hapus"
   End
End Sub

Public Function ClearDocumentsMenu() As Boolean
   'Returns true if successful, false otherwise
   SHAddToRecentDocs 2, vbNullString
   ClearDocumentsMenu = Err.LastDllError = 0
End Function


Selamat mencoba!



Friday, July 31, 2009

Report tanpa Data Environment

Ya, kita tetap bisa membuat report dengan data report tetapi tanpa data environmnet.
hal ini sangat dimungkinkan sekali, karena vb menyediakan objek data control untuk menghubungkan data report dengan database; yaitu adodc salah satunya.

oke, caranya gmn?
1. buat/desain report dengan data report
2. buat koneksi adodc-nya
3. hubungkan data report dengan adodc, yaitu..
- isi properties text pada data report dengan nama_field pada database
4. buat kodenya: letakkan di command atau objek lainnya.
set datareport1.datasource=adodc1
datareport1.show
5. oke deh selesai!

selamat mencoba!

Sunday, January 11, 2009

SQL Statement #2

Oke, lets try another SQL Statement.
i was publis little SQL Statement before...
click here if you want to see..

In this tutorial, we will include SQL statement to VB Program.
Actually, we can use any database manipulation by regular

expression or arithmatic expression, but with this way, it tooks
many code and not efficienct.

So, SQL statement simplify our way.

Suppose we have this table:
table name: member
-----------------------------
code name city age
-----------------------------
001 john depok 17
002 erica bogor 20
003 sony jakarta 18
004 wawan depok 16
005 jojo depok 25
-----------------------------

oke, case study:
1. if we to add data...
sql="insert into member values('006','dewi','bogor','18')"
means: add record, code=06, name=dewi, city=bogor, age=18

2. if we want to update data...
sql="update member set name='eric' where code='002'"
means: change erica name into eric

3. if we want to delete data...
sql="delete from member where code='005'"
means: delete the recorde that its code=005

oke, i assume we use adodc1 to connect the database, so how to
embeded SQL statement?
here is the code:

sql="..." [look at each case study above]
adodc1.recordsource=sql
adodc1.refresh


oke, that SQL statement @ glance we'll continue later...