I used the code below to add one Column
(on user demand, in a MenuHandler
):
[code]Dim ColCnt As Integer
// Get the current number of Columns and add 1
LB.ColumnCount = LB.ColumnCount + 1
// Store it in a variable
ColCnt = LB.ColumnCount
// And give it the proper name
LB.Heading(ColCnt) = “Summary”[/code]
It append one Column
, but do not set its name until I execute this code another time. The newly added Column
have its default name (8 if it is the ninth Column
).
Why ?
I found a solution and now the code is:
[code]Dim ColCnt As Integer
// Get the current number of Columns and add 1
LB.ColumnCount = LB.ColumnCount + 1
// Store it in a variable
ColCnt = LB.ColumnCount
// And give it the proper name
LB.Heading(ColCnt) = “Summary”
// Ask the program to redraw the ListBox
LB.Invalidate[/code]
Nota: LB is the reference to my ListBox.
When I changed the code I had in my method, it still display the column name, but only when I add another column (just like if LB.Invalidate
does not works
)
I folowed the docs advice to not use Refresh
even if I use that once in a while (when I want to add a Column), not in a loop.