Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C#:How to load max no of records in a combobox(more than 40000)

C#:How to load max no of records in a combobox(more than 40000)

Scheduled Pinned Locked Moved C#
csharphelptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kssknov
    wrote on last edited by
    #1

    hi I am using a combobox to load items using datatable. i am using sqlserver2005.when i tried to load a count of 32500 rows in a combobox , my application hangs more than for 5 min. Any body give me solution. Below is my code: private void _popItemCombo() //To load itemcode combobox { clsGrpObj = new clsGroupManip(); clsDataAccObj = new clsGloDataAcces(); //code to populate datatable Item table dtItem = new DataTable(); //stores item * datas dtItem = clsGrpObj._selItem_Assembly(); for (int i = 0; i < dtItem.Rows.Count - 1; i++) { string item = dtItem.Rows[i]["ItemCode"].ToString(); cmbItemCode.Items.Add(item); // code to pop combobox with datas. } } help me, Thank u

    kssk

    D 1 Reply Last reply
    0
    • K kssknov

      hi I am using a combobox to load items using datatable. i am using sqlserver2005.when i tried to load a count of 32500 rows in a combobox , my application hangs more than for 5 min. Any body give me solution. Below is my code: private void _popItemCombo() //To load itemcode combobox { clsGrpObj = new clsGroupManip(); clsDataAccObj = new clsGloDataAcces(); //code to populate datatable Item table dtItem = new DataTable(); //stores item * datas dtItem = clsGrpObj._selItem_Assembly(); for (int i = 0; i < dtItem.Rows.Count - 1; i++) { string item = dtItem.Rows[i]["ItemCode"].ToString(); cmbItemCode.Items.Add(item); // code to pop combobox with datas. } } help me, Thank u

      kssk

      D Offline
      D Offline
      darkelv
      wrote on last edited by
      #2

      You should use cmbItemCode.DateSource = dtItem and set the DisplayMember and ValueMember instead. Any auto search on the combobox? I would have to scroll 30000 rows on 8 items drop down to select a customer.... :)

      K 1 Reply Last reply
      0
      • D darkelv

        You should use cmbItemCode.DateSource = dtItem and set the DisplayMember and ValueMember instead. Any auto search on the combobox? I would have to scroll 30000 rows on 8 items drop down to select a customer.... :)

        K Offline
        K Offline
        kssknov
        wrote on last edited by
        #3

        hi darkelv just i tried that , it also takes exactly 6 seconds. If i ignore that i am experiencing the same trouble in DataGridview combobox column. Can u tell me how to overcome that . Thank u for ur quick response kssk

        senthil

        A D 2 Replies Last reply
        0
        • K kssknov

          hi darkelv just i tried that , it also takes exactly 6 seconds. If i ignore that i am experiencing the same trouble in DataGridview combobox column. Can u tell me how to overcome that . Thank u for ur quick response kssk

          senthil

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          Loading 30,000 items into a combo box is plainly not the right thing to do. A combo box is used to select from, with this many items it will be, to all intents, unusable. You need to rethink what you are trying to achieve. Can you filter your list in some way?

          Bob Ashfield Consultants Ltd

          1 Reply Last reply
          0
          • K kssknov

            hi darkelv just i tried that , it also takes exactly 6 seconds. If i ignore that i am experiencing the same trouble in DataGridview combobox column. Can u tell me how to overcome that . Thank u for ur quick response kssk

            senthil

            D Offline
            D Offline
            darkelv
            wrote on last edited by
            #5

            Like Ashfield said, there's no way around it. You just have to load less data. The problem will be worse if you do it in the DataGridViewComboboxColumn. You can subclass the combobox, let use enter the beginning letter of the item, and handle the text change or something. Once the control detected that use entered something, populate the combobox with the data beginning with the letter user entered, etc. Or use a picker dialog.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups