"fill as you type" combobox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • VMI

    "fill as you type" combobox

    How can I create a comboBox that will display the first item that begins
    with the group of letters I type? In my current combobox (it's a
    DropDownList), if I press the letters "S" and "A" consecutively, it'll
    display the first item that starts with "S" and then the first item that
    begins with "A". What can I do so that if I type those two letters, iit'll
    display the first item that starts with "SA". And if I then press "T", it'll
    display the first item with "SAT".

    Thanks.


  • clintonG

    #2
    Re: "fill as you type" combobox

    That's a client-side scripting function.
    --
    <%= Clinton Gallagher, "Twice the Results -- Half the Cost"
    Architectural & e-Business Consulting -- Software Development
    NET csgallagher@REM OVETHISTEXTmetr omilwaukee.com
    URL http://www.metromilwaukee.com/clintongallagher/

    "VMI" <vonchi_m@yahoo .com> wrote in message
    news:%23OAke7$x EHA.2036@TK2MSF TNGP12.phx.gbl. ..[color=blue]
    > How can I create a comboBox that will display the first item that begins
    > with the group of letters I type? In my current combobox (it's a
    > DropDownList), if I press the letters "S" and "A" consecutively, it'll
    > display the first item that starts with "S" and then the first item that
    > begins with "A". What can I do so that if I type those two letters, iit'll
    > display the first item that starts with "SA". And if I then press "T",[/color]
    it'll[color=blue]
    > display the first item with "SAT".
    >
    > Thanks.
    >
    >[/color]


    Comment

    • VMI

      #3
      Re: &quot;fill as you type&quot; combobox

      It's for a Windows ComboBox.


      "clintonG" <csgallagher@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
      news:OqqrZ$$xEH A.3808@tk2msftn gp13.phx.gbl...[color=blue]
      > That's a client-side scripting function.
      > --
      > <%= Clinton Gallagher, "Twice the Results -- Half the Cost"
      > Architectural & e-Business Consulting -- Software Development
      > NET csgallagher@REM OVETHISTEXTmetr omilwaukee.com
      > URL http://www.metromilwaukee.com/clintongallagher/
      >
      > "VMI" <vonchi_m@yahoo .com> wrote in message
      > news:%23OAke7$x EHA.2036@TK2MSF TNGP12.phx.gbl. ..[color=green]
      >> How can I create a comboBox that will display the first item that begins
      >> with the group of letters I type? In my current combobox (it's a
      >> DropDownList), if I press the letters "S" and "A" consecutively, it'll
      >> display the first item that starts with "S" and then the first item that
      >> begins with "A". What can I do so that if I type those two letters,
      >> iit'll
      >> display the first item that starts with "SA". And if I then press "T",[/color]
      > it'll[color=green]
      >> display the first item with "SAT".
      >>
      >> Thanks.
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • Nicholas Paldino [.NET/C# MVP]

        #4
        Re: &quot;fill as you type&quot; combobox

        VMI,

        You will have to hook up to the TextChanged event. When the text
        changes, filter the list (using a DataView) and take the text of the first
        result, setting the text of the combo box to that. You would have to have a
        check in your handler of course, to determine whether or not to handle the
        event (when you change the text, another TextChanged event would be fired).

        Of course, you also want to highlight the text that they typed in, and
        place the caret at the appropriate position.

        You might also want to consider the autocomplete drop down box, which is
        made available in 2.0 through a managed interface, or through the P/Invoke
        layer in .NET 1.1 and before.

        Hope this helps.


        --
        - Nicholas Paldino [.NET/C# MVP]
        - mvp@spam.guard. caspershouse.co m

        "VMI" <vonchi_m@yahoo .com> wrote in message
        news:%23bAPFDAy EHA.1260@TK2MSF TNGP12.phx.gbl. ..[color=blue]
        > It's for a Windows ComboBox.
        >
        >
        > "clintonG" <csgallagher@RE MOVETHISTEXTmet romilwaukee.com > wrote in message
        > news:OqqrZ$$xEH A.3808@tk2msftn gp13.phx.gbl...[color=green]
        >> That's a client-side scripting function.
        >> --
        >> <%= Clinton Gallagher, "Twice the Results -- Half the Cost"
        >> Architectural & e-Business Consulting -- Software Development
        >> NET csgallagher@REM OVETHISTEXTmetr omilwaukee.com
        >> URL http://www.metromilwaukee.com/clintongallagher/
        >>
        >> "VMI" <vonchi_m@yahoo .com> wrote in message
        >> news:%23OAke7$x EHA.2036@TK2MSF TNGP12.phx.gbl. ..[color=darkred]
        >>> How can I create a comboBox that will display the first item that begins
        >>> with the group of letters I type? In my current combobox (it's a
        >>> DropDownList), if I press the letters "S" and "A" consecutively, it'll
        >>> display the first item that starts with "S" and then the first item that
        >>> begins with "A". What can I do so that if I type those two letters,
        >>> iit'll
        >>> display the first item that starts with "SA". And if I then press "T",[/color]
        >> it'll[color=darkred]
        >>> display the first item with "SAT".
        >>>
        >>> Thanks.
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • clintonG

          #5
          Re: &quot;fill as you type&quot; combobox

          I think I saw a Windows Forms solution with this functionality
          at CodeProject.


          --
          <%= Clinton Gallagher, "Twice the Results -- Half the Cost"
          Architectural & e-Business Consulting -- Software Development
          NET csgallagher@REM OVETHISTEXTmetr omilwaukee.com
          URL http://www.metromilwaukee.com/clintongallagher/



          "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
          message news:O2qI$KAyEH A.1308@TK2MSFTN GP09.phx.gbl...[color=blue]
          > VMI,
          >
          > You will have to hook up to the TextChanged event. When the text
          > changes, filter the list (using a DataView) and take the text of the first
          > result, setting the text of the combo box to that. You would have to have[/color]
          a[color=blue]
          > check in your handler of course, to determine whether or not to handle the
          > event (when you change the text, another TextChanged event would be[/color]
          fired).[color=blue]
          >
          > Of course, you also want to highlight the text that they typed in, and
          > place the caret at the appropriate position.
          >
          > You might also want to consider the autocomplete drop down box, which[/color]
          is[color=blue]
          > made available in 2.0 through a managed interface, or through the P/Invoke
          > layer in .NET 1.1 and before.
          >
          > Hope this helps.
          >
          >
          > --
          > - Nicholas Paldino [.NET/C# MVP]
          > - mvp@spam.guard. caspershouse.co m
          >
          > "VMI" <vonchi_m@yahoo .com> wrote in message
          > news:%23bAPFDAy EHA.1260@TK2MSF TNGP12.phx.gbl. ..[color=green]
          > > It's for a Windows ComboBox.
          > >
          > >
          > > "clintonG" <csgallagher@RE MOVETHISTEXTmet romilwaukee.com > wrote in[/color][/color]
          message[color=blue][color=green]
          > > news:OqqrZ$$xEH A.3808@tk2msftn gp13.phx.gbl...[color=darkred]
          > >> That's a client-side scripting function.
          > >> --
          > >> <%= Clinton Gallagher, "Twice the Results -- Half the Cost"
          > >> Architectural & e-Business Consulting -- Software Development
          > >> NET csgallagher@REM OVETHISTEXTmetr omilwaukee.com
          > >> URL http://www.metromilwaukee.com/clintongallagher/
          > >>
          > >> "VMI" <vonchi_m@yahoo .com> wrote in message
          > >> news:%23OAke7$x EHA.2036@TK2MSF TNGP12.phx.gbl. ..
          > >>> How can I create a comboBox that will display the first item that[/color][/color][/color]
          begins[color=blue][color=green][color=darkred]
          > >>> with the group of letters I type? In my current combobox (it's a
          > >>> DropDownList), if I press the letters "S" and "A" consecutively, it'll
          > >>> display the first item that starts with "S" and then the first item[/color][/color][/color]
          that[color=blue][color=green][color=darkred]
          > >>> begins with "A". What can I do so that if I type those two letters,
          > >>> iit'll
          > >>> display the first item that starts with "SA". And if I then press "T",
          > >> it'll
          > >>> display the first item with "SAT".
          > >>>
          > >>> Thanks.
          > >>>
          > >>>
          > >>
          > >>[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...