Textbox auto-complete feature

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

    #1

    Textbox auto-complete feature

    Hi,

    I am developing an application using VB.Net and hope that the textbox can
    process features which are similar to auto-complete features in Window. For
    example, when user types "ap" in a textbox and the data associated to the
    textbox contains ("apple", "applet", "application".. ....), the application
    will suggest "apple" to the user to select and user can either select the
    suggestion or continue to type another word he disires.

    How to achieve this features?

    Thanks for your help and attention.

    Rgs,
    John
  • Cor Ligthert [MVP]

    #2
    Re: Textbox auto-complete feature

    John,

    If you mean in a windows form and a historical set of words used in your
    program, than it will be in my opinion the most easy using the regisistry
    and the keyUp event from the textbox.

    If it is a set of words general used in your organisation than you will have
    to read it first from a database or have it fixed as words in your program.

    Just as idea

    Cor

    "John" <John@discussio ns.microsoft.co m> schreef in bericht
    news:A4A88895-5C83-4E29-BC97-C195602A58BC@mi crosoft.com...[color=blue]
    > Hi,
    >
    > I am developing an application using VB.Net and hope that the textbox
    > can
    > process features which are similar to auto-complete features in Window.
    > For
    > example, when user types "ap" in a textbox and the data associated to the
    > textbox contains ("apple", "applet", "application".. ....), the application
    > will suggest "apple" to the user to select and user can either select the
    > suggestion or continue to type another word he disires.
    >
    > How to achieve this features?
    >
    > Thanks for your help and attention.
    >
    > Rgs,
    > John[/color]


    Comment

    • Ken Tucker [MVP]

      #3
      Re: Textbox auto-complete feature

      Hi,

      In addition to Cor's comments vb.net 2005 has an autocomplete
      feature.

      http://msdn2.microsoft.com/en-us/library/chff42zw

      http://msdn2.microsoft.com/en-us/library/aehe18z8

      Ken
      ---------------------
      "John" <John@discussio ns.microsoft.co m> wrote in message
      news:A4A88895-5C83-4E29-BC97-C195602A58BC@mi crosoft.com...[color=blue]
      > Hi,
      >
      > I am developing an application using VB.Net and hope that the textbox
      > can
      > process features which are similar to auto-complete features in Window.
      > For
      > example, when user types "ap" in a textbox and the data associated to the
      > textbox contains ("apple", "applet", "application".. ....), the application
      > will suggest "apple" to the user to select and user can either select the
      > suggestion or continue to type another word he disires.
      >
      > How to achieve this features?
      >
      > Thanks for your help and attention.
      >
      > Rgs,
      > John[/color]


      Comment

      • Bob Powell [MVP]

        #4
        Re: Textbox auto-complete feature

        If you're interested in a commercial solution contact me offline.

        --
        Bob Powell [MVP]
        Visual C#, System.Drawing

        Ramuseco Limited .NET consulting


        Find great Windows Forms articles in Windows Forms Tips and Tricks


        Answer those GDI+ questions with the GDI+ FAQ


        All new articles provide code in C# and VB.NET.
        Subscribe to the RSS feeds provided and never miss a new article.





        "John" <John@discussio ns.microsoft.co m> wrote in message
        news:A4A88895-5C83-4E29-BC97-C195602A58BC@mi crosoft.com...[color=blue]
        > Hi,
        >
        > I am developing an application using VB.Net and hope that the textbox
        > can
        > process features which are similar to auto-complete features in Window.
        > For
        > example, when user types "ap" in a textbox and the data associated to the
        > textbox contains ("apple", "applet", "application".. ....), the application
        > will suggest "apple" to the user to select and user can either select the
        > suggestion or continue to type another word he disires.
        >
        > How to achieve this features?
        >
        > Thanks for your help and attention.
        >
        > Rgs,
        > John[/color]


        Comment

        • John

          #5
          Re: Textbox auto-complete feature

          Dear Ken,

          Thanks. But I am currently using 2003 and not yet ready to migrate to
          2005.

          Thanks for your information.

          Rgs,
          John

          "Ken Tucker [MVP]" wrote:
          [color=blue]
          > Hi,
          >
          > In addition to Cor's comments vb.net 2005 has an autocomplete
          > feature.
          >
          > http://msdn2.microsoft.com/en-us/library/chff42zw
          >
          > http://msdn2.microsoft.com/en-us/library/aehe18z8
          >
          > Ken
          > ---------------------
          > "John" <John@discussio ns.microsoft.co m> wrote in message
          > news:A4A88895-5C83-4E29-BC97-C195602A58BC@mi crosoft.com...[color=green]
          > > Hi,
          > >
          > > I am developing an application using VB.Net and hope that the textbox
          > > can
          > > process features which are similar to auto-complete features in Window.
          > > For
          > > example, when user types "ap" in a textbox and the data associated to the
          > > textbox contains ("apple", "applet", "application".. ....), the application
          > > will suggest "apple" to the user to select and user can either select the
          > > suggestion or continue to type another word he disires.
          > >
          > > How to achieve this features?
          > >
          > > Thanks for your help and attention.
          > >
          > > Rgs,
          > > John[/color]
          >
          >
          >[/color]

          Comment

          • John

            #6
            Re: Textbox auto-complete feature

            Dear Cor,

            Thanks for your idea. But I need a bit more details. According to your
            reply, I will retrieve the "values" from database during the FormLoad events.
            Then when user types in the text box, I will place code in the KeyUp event
            to pick up values according to user's types in. But what to do to display
            the value? There are two approaches for me to consider but I have problem to
            achieve it.

            1.) Display a list of values for user to select. The interface will look
            like displaying a Context Menu but Context menu requires a mouse pointing to
            that field and then Right Click the field. However, in my case, there will
            not be any mouse over event as well as right lick events. There are only a
            series of keypress or keyup events. Is there any Controls and Events which
            can achieve this things?

            2.) Display a value for user to complete the field. It is exactly the
            case that when you are typing "Sat" in MS Word, Word will display "Saturday"
            in a tool tip text box nearby where you type. If that is what user wants to
            type, user just press <Enter> to get the value. But What Events and Controls
            in VB.Net is required to achieve this effect? I have tried ToolTip controls
            but this control requires Mouse Over events.

            Thanks for your suggestion

            Rgs,
            John



            "Cor Ligthert [MVP]" wrote:
            [color=blue]
            > John,
            >
            > If you mean in a windows form and a historical set of words used in your
            > program, than it will be in my opinion the most easy using the regisistry
            > and the keyUp event from the textbox.
            >
            > If it is a set of words general used in your organisation than you will have
            > to read it first from a database or have it fixed as words in your program.
            >
            > Just as idea
            >
            > Cor
            >
            > "John" <John@discussio ns.microsoft.co m> schreef in bericht
            > news:A4A88895-5C83-4E29-BC97-C195602A58BC@mi crosoft.com...[color=green]
            > > Hi,
            > >
            > > I am developing an application using VB.Net and hope that the textbox
            > > can
            > > process features which are similar to auto-complete features in Window.
            > > For
            > > example, when user types "ap" in a textbox and the data associated to the
            > > textbox contains ("apple", "applet", "application".. ....), the application
            > > will suggest "apple" to the user to select and user can either select the
            > > suggestion or continue to type another word he disires.
            > >
            > > How to achieve this features?
            > >
            > > Thanks for your help and attention.
            > >
            > > Rgs,
            > > John[/color]
            >
            >
            >[/color]

            Comment

            • Cor Ligthert [MVP]

              #7
              Re: Textbox auto-complete feature

              John,

              You make it yourself very difficult by using a textbox. The combobox and
              listbox have both a findstring method. That is especially for this kind of
              operations. I have made myself a combobox autocomplete sample, however that
              is for a very special one. If you search Google for combobox autocomplete
              you find tons of those.



              In the way you want it with a textbox, you will need to find that string
              everytime, for what I will think that only a datatable.selec t will fit

              http://msdn.microsoft.com/library/de...electtopic.asp

              I hope this helps something.

              Cor


              Comment

              • John

                #8
                Re: Textbox auto-complete feature

                Dear Cor,

                Thanks for your reply and sorry for my late reply because I have to
                investigate some API of Fax Automation for the system as well. I hope you
                can notice this mail and give me some idea.

                I have just retried the ComboBox as you have told me about and I know
                that Combo is close to what I need because it can type in value and choose
                value. Unfortunately, I cannot make what my Mgr wants exactly. So, let me
                explain in details. Maybe you have work-around method on Combo Box that can
                achieve my Mgr requirement.

                In the application, there are some free format fields like job title of
                our customer. I cannot predefine these fields because they vary much.
                However, my Mgr hopes that I can create a field (not a must to be a textbox)
                that can achieve the following 2 cases.

                1) when user has to type in a value that exists before, the field can auto
                fill / suggest the value. For example, the database contains "Analyst
                Programmer" and user has typed "analyst programmer", the application will
                automatically fill / suggest "Analyst Programmer". This feature helps to
                reduce typing mistake.

                2) when user has to type in a value that is not exists before but similar,
                the system will suggest / fill the value but user can override with his
                actual value. For example, the database has "assistant manager" but the user
                wants to enter "Assistant Supervisor".

                Thanks for your help so far and I hope the above description let you
                understand more on my situation and you can suggest some good ideas for me.

                Thank you very much.

                Rgs,
                John

                "Cor Ligthert [MVP]" wrote:
                [color=blue]
                > John,
                >
                > You make it yourself very difficult by using a textbox. The combobox and
                > listbox have both a findstring method. That is especially for this kind of
                > operations. I have made myself a combobox autocomplete sample, however that
                > is for a very special one. If you search Google for combobox autocomplete
                > you find tons of those.
                >
                > http://groups.google.com/group/micro...1d7cb3c?hl=en&
                >
                > In the way you want it with a textbox, you will need to find that string
                > everytime, for what I will think that only a datatable.selec t will fit
                >
                > http://msdn.microsoft.com/library/de...electtopic.asp
                >
                > I hope this helps something.
                >
                > Cor
                >
                >
                >[/color]

                Comment

                • Cor Ligthert [MVP]

                  #9
                  Re: Textbox auto-complete feature

                  John,

                  This is in my idea recognizing a word and than get the most possible
                  equivalent. In my opinion is this more a natural language problem than a
                  program language problem. To find the equivalents in a table when you know
                  those (even with wildcards) is probably as well for you no problem. However
                  creating that table, that will be the problem especially for most developers
                  which are not always the best in natural languages.

                  Maybe can *speech* help you (I have no experience with that), otherwise I
                  would tell to your manager something the same as I wrote above and ask him
                  if he is able to create that table for you.

                  I hope this helps.

                  Cor


                  Comment

                  Working...