I fill a ListBox Heading using:
LB.Heading(0) = "Story #"
LB.Heading(1) = "Story Title"
LB.Heading(2) = "Date Start"
LB.Heading(3) = "Date End"
LB.Heading(4) = "Size (Bytes)"
LB.Heading(5) = "Kind (Extension)"
LB.Heading(6) = "Comments"
and that was good.
I had a bug there, and I squashed it. Then, I saw that code and decided to modify it to follow the “”,"","" path.
Unfortunately, this is a syntax from AddRow
, not allowed here.
So, I used the -1
trick.
An this was good.
All of a sudden, I had a bad suspicion: what if I put more entries than the number of columns ? (or less ? *)
Used code:
LB.Heading(-1) = "Character" + Chr(9) + "Story #" + Chr(9) + "Story Title" + Chr(9) + "Date Start" + Chr(9) + "Date End" + Chr(9) + "Size (Bytes)" + Chr(9) + "Kind (Extension)" + Chr(9) + "Comments"
The ListBox had one column less than the number of passed strngs:
Eureka !
No crash: I only lost the definition for the last column (Comments, here).
BTW: I forgot to say that I had a bug in the code far above: there was a case where there was less than 7 columns and I was trying to add a string to a Header column that does not exists ! (thus the Eureka).
FWIW.
- Less: the language reference says the ListBox will display the default value (usually the Column #).