Public Sub dinamicLv(strSql As String, lv As ListView)
Dim rs As New MYSQL_RS
Dim i, j, k As Integer
With lv
.view = lvwReport
.Gridlines = True
.FullRowSelect = True
.HotTracking = True
.ColumnHeaders.Clear
.CheckBoxes = True
'Ambil Header
rs.OpenRs strSql, db
If rs.EOF = False Then
lv.ColumnHeaders.Clear
lv.ColumnHeaders.Add , , 0, 1
For i = 0 To rs.FieldCount - 1
lv.ColumnHeaders.Add , , rs.Fields(i).Name
Next i
End If
rs.CloseRecordset
'Ambil Data
rs.OpenRs strSql, db
If rs.EOF = False Then
lv.ListItems.Clear
rs.MoveFirst
Do While Not rs.EOF
Set List = lv.ListItems.Add
For j = 1 To i
List.SubItems(j) = rs.Fields(j - 1).Value
Next
rs.MoveNext
Loop
End If
rs.CloseRecordset
End With
End Sub
0 comments:
Posting Komentar