cyberbiker
Programmer
I need to find how to add columns to the list view control at run time.
Can it be done? If so, how? I cannot seem to figure it out.
I am reading a database with a user entered SQL Statement. I then need to display the results in a listview control. Since the recordset may contain from 1 to an unrealistically high number of fields, I need to create coulumns and adjust column widths accordingly.
The basic plan is something like this:
Private Sub sethead()
Dim f As Field, i As Integer
If rs.RecordCount > 0 Then
i = 1
For Each f In rs.Fields
CREATE COLUMN(i) HERE
lvRS.Column(i).header = f.name
column(i).Width = column(i).TextWidth
i = i + 1
Next
End If
End Sub
Then I will loop through the recordset adding the values.
I am stuck with using the listview control unless it proves to be impossible to create columns at run time.
Any help will be appreciated greatly. Terry (cyberbiker)
Can it be done? If so, how? I cannot seem to figure it out.
I am reading a database with a user entered SQL Statement. I then need to display the results in a listview control. Since the recordset may contain from 1 to an unrealistically high number of fields, I need to create coulumns and adjust column widths accordingly.
The basic plan is something like this:
Private Sub sethead()
Dim f As Field, i As Integer
If rs.RecordCount > 0 Then
i = 1
For Each f In rs.Fields
CREATE COLUMN(i) HERE
lvRS.Column(i).header = f.name
column(i).Width = column(i).TextWidth
i = i + 1
Next
End If
End Sub
Then I will loop through the recordset adding the values.
I am stuck with using the listview control unless it proves to be impossible to create columns at run time.
Any help will be appreciated greatly. Terry (cyberbiker)