1. Buatlah form yang berisi Listview
2. Copy script berikut
3. panggil di form-load
- call TabelClient
- call DataClient
Sub TabelClient()
With ListView1
.view = lvwReport
.GridLines = True
.FullRowSelect = True
.HotTracking = True
.ColumnHeaders.Clear
With .ColumnHeaders
.Add , , 0, 1
.Add , , "No", 700, lvwColumnCenter
.Add , , "Kode", 900, lvwColumnCenter
.Add , , "Nama Client", 4500
.Add , , "Alamat", 7500
.Add , , "Kota", 2500
.Add , , "Telpon", 1500
.Add , , "Fax", 1500
End With
End With
End Sub
Sub DataClient()
Dim rs As New MYSQL_RS
Dim rs2 As New MYSQL_RS
On Error Resume Next
rs.OpenRs "SELECT * " & _
"FROM data_client_master ", db
ListView1.ListItems.Clear
If rs.EOF = False Then
ListView1.ListItems.Clear
rs.MoveFirst
Do While Not rs.EOF
Set List = ListView1.ListItems.Add
List.SubItems(1) = Me.ListView1.ListItems.Count
List.SubItems(2) = rs.Fields("client_kode")
List.SubItems(3) = rs.Fields("client_nama")
List.SubItems(4) = rs.Fields("client_alamat")
List.SubItems(5) = rs.Fields("client_kota")
List.SubItems(6) = rs.Fields("client_telpon")
List.SubItems(7) = rs.Fields("client_fax")
rs.MoveNext
Loop
End If
rs.CloseRecordset
lblJumlah.Caption = "Jumlah : " & ListView1.ListItems.Count
End Sub
Menampilkan Data dengan Listview di VB6 + Mysql
Langganan:
Posting Komentar (Atom)
0 comments:
Posting Komentar