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. autocomplete selection

autocomplete selection

Scheduled Pinned Locked Moved C#
question
5 Posts 2 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.
  • I Offline
    I Offline
    Iain Wiseman
    wrote on last edited by
    #1

    Hi, Sorry this is gonna sound stupid I expect but here goes Using m_AutoCompleteStringCollection = new AutoCompleteStringCollection(); textBoxName.AutoCompleteMode = AutoCompleteMode.Suggest; textBoxName.AutoCompleteSource = AutoCompleteSource.CustomSource; textBoxName.AutoCompleteCustomSource = m_AutoCompleteStringCollection; How, without a mouse, do you select an item for an autocomplete textbox? I have tried key down on the keyboard but that just makes a selection of the first item. I want the user to be able to select any item or type their one choice. This is going to be used as a login where the name can be a known name or a visitor. Thanks, Iain

    D 1 Reply Last reply
    0
    • I Iain Wiseman

      Hi, Sorry this is gonna sound stupid I expect but here goes Using m_AutoCompleteStringCollection = new AutoCompleteStringCollection(); textBoxName.AutoCompleteMode = AutoCompleteMode.Suggest; textBoxName.AutoCompleteSource = AutoCompleteSource.CustomSource; textBoxName.AutoCompleteCustomSource = m_AutoCompleteStringCollection; How, without a mouse, do you select an item for an autocomplete textbox? I have tried key down on the keyboard but that just makes a selection of the first item. I want the user to be able to select any item or type their one choice. This is going to be used as a login where the name can be a known name or a visitor. Thanks, Iain

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Down arrow works fine for me. Set the focus to the item to be selected and press enter to select.

      जय हिंद

      I 1 Reply Last reply
      0
      • D dan sh

        Down arrow works fine for me. Set the focus to the item to be selected and press enter to select.

        जय हिंद

        I Offline
        I Offline
        Iain Wiseman
        wrote on last edited by
        #3

        Yes you are correct. It appears that calling _TextChanged everytime resets the focus E.G. private void textBoxFirstName_TextChanged(object sender, EventArgs e) { if (textBoxName.Text.Length > 4) { getAutoCompleteSuggestions(); } } I have changed it to if (textBoxName.Text.Length == 4) To solve this It does seem to crash a lot too in debug but I will save that for another day

        D 1 Reply Last reply
        0
        • I Iain Wiseman

          Yes you are correct. It appears that calling _TextChanged everytime resets the focus E.G. private void textBoxFirstName_TextChanged(object sender, EventArgs e) { if (textBoxName.Text.Length > 4) { getAutoCompleteSuggestions(); } } I have changed it to if (textBoxName.Text.Length == 4) To solve this It does seem to crash a lot too in debug but I will save that for another day

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #4

          Is there any specific need to display the autocomplete suggestions only after 4 characters?

          जय हिंद

          I 1 Reply Last reply
          0
          • D dan sh

            Is there any specific need to display the autocomplete suggestions only after 4 characters?

            जय हिंद

            I Offline
            I Offline
            Iain Wiseman
            wrote on last edited by
            #5

            It was to keep the selection down to something reasonable. All works now thanks for your help.

            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