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. How can I fill a Combobox while writing?

How can I fill a Combobox while writing?

Scheduled Pinned Locked Moved C#
questionhelptutorial
9 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.
  • U Offline
    U Offline
    User 11883281
    wrote on last edited by
    #1

    I have a Combobox with a few items. Now i will start writing in the Combobox and then only the items who fits with my writing should be shown... for example in my Combobox are These items: "Summer, Sunshine, Winter" so if i do nothing, all should be shown if i write an "S" only "summer" and "sunshine" should be shown if i write an "Su" only "summer" and "sunshine" should be shown and if i write "Sum" only "Summer" should be shown can anyone help me please?

    P J 3 Replies Last reply
    0
    • U User 11883281

      I have a Combobox with a few items. Now i will start writing in the Combobox and then only the items who fits with my writing should be shown... for example in my Combobox are These items: "Summer, Sunshine, Winter" so if i do nothing, all should be shown if i write an "S" only "summer" and "sunshine" should be shown if i write an "Su" only "summer" and "sunshine" should be shown and if i write "Sum" only "Summer" should be shown can anyone help me please?

      P Offline
      P Offline
      PANKAJMAURYA
      wrote on last edited by
      #2

      You have to try autocompletetextbox. Auto Complete Textbox[^] Auto Complete Textbox with JQuery[^]

      Pankaj Maurya Sr. Software Engineer Gurgaon, India

      J 1 Reply Last reply
      0
      • U User 11883281

        I have a Combobox with a few items. Now i will start writing in the Combobox and then only the items who fits with my writing should be shown... for example in my Combobox are These items: "Summer, Sunshine, Winter" so if i do nothing, all should be shown if i write an "S" only "summer" and "sunshine" should be shown if i write an "Su" only "summer" and "sunshine" should be shown and if i write "Sum" only "Summer" should be shown can anyone help me please?

        J Offline
        J Offline
        John Torjo
        wrote on last edited by
        #3

        Long story short, you need to implement this yourself. For Winforms: 1. you need to keep a list of all items (originally found in the combo) 2. look for the text the user types (listed for combo's TextUpdate event) 3. recreate the combo's items, based on what the user typed; very likely, you will need to also "reopen" the combo (that is, set its DroppedDown to true) Best, John

        -- LogWizard Meet the Log Viewer that makes monitoring log files a joy!

        U 1 Reply Last reply
        0
        • P PANKAJMAURYA

          You have to try autocompletetextbox. Auto Complete Textbox[^] Auto Complete Textbox with JQuery[^]

          Pankaj Maurya Sr. Software Engineer Gurgaon, India

          J Offline
          J Offline
          John Torjo
          wrote on last edited by
          #4

          1. He was asking for a combo. 2. He was asking in c#.

          -- LogWizard Meet the Log Viewer that makes monitoring log files a joy!

          1 Reply Last reply
          0
          • U User 11883281

            I have a Combobox with a few items. Now i will start writing in the Combobox and then only the items who fits with my writing should be shown... for example in my Combobox are These items: "Summer, Sunshine, Winter" so if i do nothing, all should be shown if i write an "S" only "summer" and "sunshine" should be shown if i write an "Su" only "summer" and "sunshine" should be shown and if i write "Sum" only "Summer" should be shown can anyone help me please?

            P Offline
            P Offline
            PANKAJMAURYA
            wrote on last edited by
            #5

            You have to try Autocomplete Combobox[^] Or You can try

            this.comboBox1.AutoCompleteCustomSource.AddRange(new string[] {"summer", "sunshine", "Winter"});
            this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            this.comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;

            Pankaj Maurya Sr. Software Engineer Gurgaon, India

            U 1 Reply Last reply
            0
            • J John Torjo

              Long story short, you need to implement this yourself. For Winforms: 1. you need to keep a list of all items (originally found in the combo) 2. look for the text the user types (listed for combo's TextUpdate event) 3. recreate the combo's items, based on what the user typed; very likely, you will need to also "reopen" the combo (that is, set its DroppedDown to true) Best, John

              -- LogWizard Meet the Log Viewer that makes monitoring log files a joy!

              U Offline
              U Offline
              User 11883281
              wrote on last edited by
              #6

              Thats my Problem, i can't set the items originally in the Combo, i have to fill the Combo while the code is running.

              J 1 Reply Last reply
              0
              • P PANKAJMAURYA

                You have to try Autocomplete Combobox[^] Or You can try

                this.comboBox1.AutoCompleteCustomSource.AddRange(new string[] {"summer", "sunshine", "Winter"});
                this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                this.comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;

                Pankaj Maurya Sr. Software Engineer Gurgaon, India

                U Offline
                U Offline
                User 11883281
                wrote on last edited by
                #7

                yeah it works thank you very much!

                P 1 Reply Last reply
                0
                • U User 11883281

                  Thats my Problem, i can't set the items originally in the Combo, i have to fill the Combo while the code is running.

                  J Offline
                  J Offline
                  John Torjo
                  wrote on last edited by
                  #8

                  1. Note: Pankamauria's second solution might work - I have not used it before though. 2. The combo can be emptied and filled while the code is running - that should not be an issue. Best, John

                  -- LogWizard Meet the Log Viewer that makes monitoring log files a joy!

                  1 Reply Last reply
                  0
                  • U User 11883281

                    yeah it works thank you very much!

                    P Offline
                    P Offline
                    PANKAJMAURYA
                    wrote on last edited by
                    #9

                    your welcome...

                    Pankaj Maurya Sr. Software Engineer Gurgaon, India

                    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