I have over 9,00,000 records in my Access database but only a fraction of that is being displayed in the listbox. How Many Rows Can A Listbox Hold? Around 65K is the answer I go
I've found it preferable to use DataGridView over ListBox in winforms. The key is to use VirtualMode. I'd derive from DataGridView similar to:
class CustomDgv : DataGridView { public CustomDgv() { this.BackgroundColor = SystemColors.Window; this.BorderStyle = BorderStyle.None; this.Dock = DockStyle.Fill; this.MultiSelect = false; this.AutoGenerateColumns = false; this.RowHeadersVisible = this.AllowUserToResizeRows = false; this.ReadOnly = true; this.AllowUserToAddRows = this.AllowUserToDeleteRows = false; this.CellBorderStyle = DataGridViewCellBorderStyle.None; this.VirtualMode = true; this.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.RowTemplate.Height = this.FontHeight + this.FontHeight / 2; } }
and then implement the virtual part accordingly.