If you are adding large amount of items to list or combo using Add method, you can improve performance by calling BeginUpdate and EndUpdate methods.
Here is the code, in this two listboxs one using Begin – Edit update method calls and other one no using it. The first method fills the list box with lesser time than the second listbox.
Dim sw As New Stopwatch
sw.Start()
ListBox1.BeginUpdate()
For i As Integer = 0 To 1000
ListBox1.Items.Add("Item " & i)
Next
ListBox1.EndUpdate()
sw.Stop()
MessageBox.Show(sw.ElapsedMilliseconds)
Code for first listbox, it shows nearly 74 ms in my machine.
Dim sw As New Stopwatch
sw.Start()
For i As Integer = 0 To 1000
ListBox1.Items.Add("Item " & i)
Next
sw.Stop()MessageBox.Show(sw.ElapsedMilliseconds)
And this one shows nearly 195ms.If your using larger amount of data, using BeginUpdate and EndUpdate methods you can boostup the performance.