Fill Combobox with Large amount of Data
-
i have more than 55000 Customer and i wanna Fill Combobox with this customers quick .. there is any way to load form quickly and to enter Combobox quickly ** i use background worker but this hang my form and my app is run slowly can i use threading and how i want solutin plz
private void backWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Cancelled)
{
}
else
{
FillComboBox();
cmb3ameelname.Focus();
Loadform = true;
cmb3ameelname.SelectedItem = null;
cmbLandTele.SelectedItem = null;
}
}private void backWork_DoWork(object sender, DoWorkEventArgs e)
{
CusLis = CustomerManger.SelectCustomersAll();
}void FillComboBox()
{
cmbameelname.DataSource = CusLis;
cmbameelname.DisplayMember = "CustName";
cmbameelname.ValueMember = "CustId";
}frm_load()
{
this.backWork.DoWork += new DoWorkEventHandler(this.backWork_DoWork);this.backWork.RunWorkerCompleted+=new RunWorkerCompletedEventHandler(this.backWork\_RunWorkerCompleted); this.backWork.RunWorkerAsync();
}
-
i have more than 55000 Customer and i wanna Fill Combobox with this customers quick .. there is any way to load form quickly and to enter Combobox quickly ** i use background worker but this hang my form and my app is run slowly can i use threading and how i want solutin plz
private void backWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Cancelled)
{
}
else
{
FillComboBox();
cmb3ameelname.Focus();
Loadform = true;
cmb3ameelname.SelectedItem = null;
cmbLandTele.SelectedItem = null;
}
}private void backWork_DoWork(object sender, DoWorkEventArgs e)
{
CusLis = CustomerManger.SelectCustomersAll();
}void FillComboBox()
{
cmbameelname.DataSource = CusLis;
cmbameelname.DisplayMember = "CustName";
cmbameelname.ValueMember = "CustId";
}frm_load()
{
this.backWork.DoWork += new DoWorkEventHandler(this.backWork_DoWork);this.backWork.RunWorkerCompleted+=new RunWorkerCompletedEventHandler(this.backWork\_RunWorkerCompleted); this.backWork.RunWorkerAsync();
}
Mohamed Nabawy wrote:
have more than 55000 Customer and i wanna Fill Combobox with this customers
:wtf: That's a little bit "too much" to be useful as a dropdown-list. I strongly recommend a popup with a datagridview.
Mohamed Nabawy wrote:
. there is any way
to load form quickly and to enter Combobox quicklyDatabinding is usually a bit slower than slamming the items in there manually.
Mohamed Nabawy wrote:
i use background worker but this hang my form and my app is run slowly can i use threading and how
i want solutin plzThreading doesn't make it quicker. You'd load the list async from the DB, but databinding still has to be done on the mainthread. Binding 55000 items to a ComboBox, just to let the user select one, is a bit overkill. Things would really speed up if you convert it to a readonly textbox with a "set"-button. Open a new form (modal), and then load those 55k items. In a virtualized datagridview, if performance is an issue.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] They hate us for our freedom![^]
-
i have more than 55000 Customer and i wanna Fill Combobox with this customers quick .. there is any way to load form quickly and to enter Combobox quickly ** i use background worker but this hang my form and my app is run slowly can i use threading and how i want solutin plz
private void backWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Cancelled)
{
}
else
{
FillComboBox();
cmb3ameelname.Focus();
Loadform = true;
cmb3ameelname.SelectedItem = null;
cmbLandTele.SelectedItem = null;
}
}private void backWork_DoWork(object sender, DoWorkEventArgs e)
{
CusLis = CustomerManger.SelectCustomersAll();
}void FillComboBox()
{
cmbameelname.DataSource = CusLis;
cmbameelname.DisplayMember = "CustName";
cmbameelname.ValueMember = "CustId";
}frm_load()
{
this.backWork.DoWork += new DoWorkEventHandler(this.backWork_DoWork);this.backWork.RunWorkerCompleted+=new RunWorkerCompletedEventHandler(this.backWork\_RunWorkerCompleted); this.backWork.RunWorkerAsync();
}
To add to what Eddy said - it's a very silly idea to put that many items into a control of any sort if you expect the user to have to pick one of them himself. Think about it as a user: how are you going to find the one item you want out of 55,000? How much time are you going to waste looking? Find a better solution! Search, filter, whatever - but not "here's a big list - you sort it out".
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
-
i have more than 55000 Customer and i wanna Fill Combobox with this customers quick .. there is any way to load form quickly and to enter Combobox quickly ** i use background worker but this hang my form and my app is run slowly can i use threading and how i want solutin plz
private void backWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Cancelled)
{
}
else
{
FillComboBox();
cmb3ameelname.Focus();
Loadform = true;
cmb3ameelname.SelectedItem = null;
cmbLandTele.SelectedItem = null;
}
}private void backWork_DoWork(object sender, DoWorkEventArgs e)
{
CusLis = CustomerManger.SelectCustomersAll();
}void FillComboBox()
{
cmbameelname.DataSource = CusLis;
cmbameelname.DisplayMember = "CustName";
cmbameelname.ValueMember = "CustId";
}frm_load()
{
this.backWork.DoWork += new DoWorkEventHandler(this.backWork_DoWork);this.backWork.RunWorkerCompleted+=new RunWorkerCompletedEventHandler(this.backWork\_RunWorkerCompleted); this.backWork.RunWorkerAsync();
}
As others have said 55,000 items in a combobox is a HORRIBLE idea. How is anybody going to find an item in there? Find a better design.
-
Mohamed Nabawy wrote:
have more than 55000 Customer and i wanna Fill Combobox with this customers
:wtf: That's a little bit "too much" to be useful as a dropdown-list. I strongly recommend a popup with a datagridview.
Mohamed Nabawy wrote:
. there is any way
to load form quickly and to enter Combobox quicklyDatabinding is usually a bit slower than slamming the items in there manually.
Mohamed Nabawy wrote:
i use background worker but this hang my form and my app is run slowly can i use threading and how
i want solutin plzThreading doesn't make it quicker. You'd load the list async from the DB, but databinding still has to be done on the mainthread. Binding 55000 items to a ComboBox, just to let the user select one, is a bit overkill. Things would really speed up if you convert it to a readonly textbox with a "set"-button. Open a new form (modal), and then load those 55k items. In a virtualized datagridview, if performance is an issue.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] They hate us for our freedom![^]
-
As others have said 55,000 items in a combobox is a HORRIBLE idea. How is anybody going to find an item in there? Find a better design.
-
To add to what Eddy said - it's a very silly idea to put that many items into a control of any sort if you expect the user to have to pick one of them himself. Think about it as a user: how are you going to find the one item you want out of 55,000? How much time are you going to waste looking? Find a better solution! Search, filter, whatever - but not "here's a big list - you sort it out".
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.