Listview Column Count

  • Thread starter Thread starter Maurice
  • Start date Start date
M

Maurice

Hi,

Anyone know how to get the columncount from a listview from code. Here's
what I would like to achieve...

Recordset with 4 fields

I know how to program the listview when the columncount is always the same.
What I would like to do is return the number of fields via VBA and then
dynamically add the number of columns to the listview. So if I have 7 fields
I would like to create the listview with 7 columns. How do I add these
columns in the listview?

Thanx in advance i you can provide me any directions
 
Me.lvDetails.ColumnHeaders.Count will tell you how many columns you already
have.

To add another column, use something like:

Me.lvDetails.ColumnHeaders.Add _
Index:=1, _
Key:="Col0", _
Text:="Column Title"

Other arguments for the Add method include Width, Alignment and Icon
 
Back
Top