I was fooling around in a SQLite reporting project and changed bits here and there.
Fortunately, I made backups and Comments “previous” code before changes
The code below is far slower than the other (and prior) variant, bar bottom.
The deal is to set the same width to all Columns to set the Listbox in mode 1 (or is it mode 0 ?) : enable the horizontal ScrollBar.
Slow code:
[code] LB_Records.ColumnCount = rc
// Fills the ListBox Headings
For LoopIdx = 0 To rc
// Read and set the current Record
LB_Records.Heading(LoopIdx) = rs.IdxField(1).StringValue // Only PNom, Nom, Wife, etc. is available here
// Get the next Record
rs.MoveNext
// Change the current Column width to 100 pixels
LB_Records.Column(LoopIdx).WidthActual = 100
Next[/code]
Faster code:
[code]LB_Records.ColumnCount = rc
// Fills the ListBox Headings
For LoopIdx = 0 To rc
// Read and set the current Record
LB_Records.Heading(LoopIdx) = rs.IdxField(1).StringValue
// Get the next Record
rs.MoveNext
// [2016-07-22] Compute the Listbox ColumnWidth string
ColWidths = ColWidths + "100,"
Next
// -------- -------- -------- -------- -------- -------- -------- --------
// [2016-07-22] Added the ColumnWidths value [to change the Listbox mode]
// Activate the horizontal ScrollBar
// [2016-07-22] Remove the ending comma
ColWidths = Left(ColWidths,Len(ColWidths)-1)
// [2016-07-22] Set the Listbox ColumnWidth string
LB_Records.ColumnWidths = ColWidths[/code]
Isnt it strange ?
I commented my slow code and keep the old one !