How to speed up a combo box populating speed? Academically speaking, imagine that a combox box has 1 billion records to be presented. How would we maximize the speed of the program.
What other methods could I use instead of a combo box to display data?
Here are the details for my particular question:
I am using WPF event handler
<ComboBox Height="24" SelectedIndex="0" HorizontalAlignment="Left"
Margin="146,27,0,0" Name="emoployeeUserNameComboBox" VerticalAlignment="Top"
Width="198" Loaded="emoployeeUserNameComboBox_Loaded"/>
private void emoployeeUserNameComboBox_Loaded(object sender, RoutedEventArgs e) {
using (ToolboxDataContext dbToolbox = new ToolboxDataContext()) {
var query = (from x in dbToolbox.DropDownEmployeesUserNames()
select x.UserName).ToList();
this.emoployeeUserNameComboBox.ItemsSource = query;
}
The stored procedure above DropDownEmployeesUserNames is defined as
SELECT [UserName],Emp_Number
FROM AdminUser
ORDER BY UserName
It returns 14,257 rows
Combo boxes are meant to contain a limited set of options. If you wish to allow someone to select from 1 billion options, you are better served to use an autocomplete coupled with a button that brings up a popup window that allows efficient searching of the data needed to select an item. I tend to build a pop-up with the following features: