You must Sign In to post a response.
  • Category: ASP.NET

    How to speed up combobox binding

    How to speed up combobox binding in windowformapplication

    var list=ds.Tables[0].AsEnumerable()
    .Select(r => r.Field<string>("job")).ToArray();

    combobox.BeginUpdate();
    combobox.DisplayMember = "job";
    combobox.ValueMember = "job";
    combobox.DataSource = new BindingSource(list,null);
    combobox.EndUpdate();


    In this below line,it is taking time to bind and it s very slow.. How to make it fast
    combobox.DataSource = new BindingSource(list,null);
  • #765877
    How many records are exist in database ? depend upon the record size it may take time.
    secondly your database connection is also affect the scenario.

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765880
    Optimize your Data Base Query - using Index ,select Statement using Particular Record.

    use Stored Procedure to Retrieve the values from Data Base.

  • #765885
    1000 are in database.. Just single column in a table..

    Select query is fast.. only in this datasource binding it is taking time.. I checked with breakpoints

  • #765892
    Hi,
    Try this:
    comboBox.Items.Clear();
    comboBox.Items.AddRange(list);

    Hope it helps.!

  • #765896
    Hi

    try this type code only



    combobox.DisplayMember = "job";
    combobox.ValueMember = "job";
    combobox.DataSource = Datatable or Dataset or list


    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


  • Sign In to post your comments