ListBox issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • renuami
    New Member
    • Feb 2009
    • 15

    ListBox issue

    Hello
    I have a listbox with 30 items/values and i am binding these values from database. Here is my question when 'A' is pressed automatically how can i transfer the control to the word that starts with 'A' and when 'B' is pressed control should go to the word that starts with 'B' and so on......

    Please advise
  • bhupinder
    New Member
    • Feb 2009
    • 32

    #2
    ListBox issue

    Hiiiiiii
    You can solve this problem using ajax toolkit and web service.



    Please visit this link.



    Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      Can't you just use the KeyPress event to a method that loops through the ListBox.Items and checks if it it starts with the letter pressed?

      That's how I would do it in a Windows Forms application.

      Comment

      • bhupinder
        New Member
        • Feb 2009
        • 32

        #4
        ListBox issue

        Originally posted by tlhintoq
        Can't you just use the KeyPress event to a method that loops through the ListBox.Items and checks if it it starts with the letter pressed?

        That's how I would do it in a Windows Forms application.
        i dont know why do you need to list box u can do this work from textbox
        bec. u cant input anything in list box, this is work like combo box.

        Comment

        • tlhintoq
          Recognized Expert Specialist
          • Mar 2008
          • 3532

          #5
          Originally posted by bhupinder
          i dont know why do you need to list box u can do this work from textbox
          bec. u cant input anything in list box, this is work like combo box.
          The O.P. (Original Poster) never said anything about needing to input text. The need was to select an item from a list of choices. Think of it like selecting a country from a list: You don't type in "United States". You hit 'U' and the first country that starts with 'U' is brough to the selection.

          Comment

          • bhupinder
            New Member
            • Feb 2009
            • 32

            #6
            ListBox issue

            Originally posted by tlhintoq
            The O.P. (Original Poster) never said anything about needing to input text. The need was to select an item from a list of choices. Think of it like selecting a country from a list: You don't type in "United States". You hit 'U' and the first country that starts with 'U' is brough to the selection.
            Ok, i agree with u. but one thing tell me, you need to some button or input any control in which you can type 'U' that word you select, If you want this way , i think , this is more compatible.

            Comment

            • alamodgal
              New Member
              • Dec 2008
              • 38

              #7
              hiiiiiiiiiiiiii i

              Follow this link

              Comment

              • tlhintoq
                Recognized Expert Specialist
                • Mar 2008
                • 3532

                #8
                Originally posted by bhupinder
                Ok, i agree with u. but one thing tell me, you need to some button or input any control in which you can type 'U' that word you select, If you want this way , i think , this is more compatible.
                Yes, and no. You have to have a control that receives the action of pressing a key. That is not the same as having a control that *displays* the key you press. Using a textbox as the tool to have a listbox make a selection just confuses the user. The ListBox itself can react to a KeyPress if it is the control that has focus.

                Or one can get fairly exotic and start intercepting the Windows Messages for keys being pressed and decide where to route those messages. This is how I handle "behavior shortcut keys" is some applications.

                Comment

                Working...