Results 1 to 13 of 13

Thread: is it possible to code a textbox with automatic complete?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    41

    Question is it possible to code a textbox with automatic complete?

    a textbox control with automatic complete function like vb.net coding?
    With the automatic complete function, the textbox control will show an additional window for prompting user's input.

    by the way, I do not want to use combobox. also the automatic complete function in combobox is very ugly.

    thanks!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: is it possible to code a textbox with automatic complete?

    From .NET 2.0 the TextBox control supports autocomplete functionality. If you'd read the documentation for the TextBox class, or just looked in the Properties window, you'd have seen the properties whose names start with "AutoComplete". That would be the tell. Look first, ask questions later.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    41

    Re: is it possible to code a textbox with automatic complete?

    Maybe I did not find the "automatic complete" in the property window.
    I will check that again.
    by the way, can i Pre-define the automatic complete items?

    you guys are not friendly, but anyway I will thank you for your reply.

  4. #4
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: is it possible to code a textbox with automatic complete?

    This should help you

    Code:
    Dim arr_strVAlues() As String = New String() {"This", "Is", "Sample", "Text"}
    
                TextBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend
                TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
                TextBox1.AutoCompleteCustomSource.AddRange(arr_strVAlues)
    __________________
    Rate the posts that helped you

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: is it possible to code a textbox with automatic complete?

    It's only me that that isn't friendly, and then only when the person asking the question has ignored the information that is immediately available to them. Lots of other people are quite happy to post the obvious, so don't let my reply put you off.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: is it possible to code a textbox with automatic complete?

    Quote Originally Posted by stripling
    you guys are not friendly, but anyway I will thank you for your reply.
    i didnt noticed that
    __________________
    Rate the posts that helped you

  7. #7
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: is it possible to code a textbox with automatic complete?

    jmc is rather short-tempered, but the fact is you really should have taken a look at the BEFORE YOU POST sticky at the top of this forum. Reading that, and applying it's advice makes it easier for us to understand your problem and increases your likelihood of getting a useful reply

  8. #8
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: is it possible to code a textbox with automatic complete?

    I'd just like to say as well that I originally thought some of the more experienced users on here were quite unfriendly and rude but after being on here for a while now I can see why... I mean so many people ask the same questions that have already been answered so many times before and like jmc said, if people bothered reading the documentation then about 50% of the questions on here would probably not need to be posted. Having said that though, sometimes when you are fairly new to a particular method of doing something or even new to VB.NET itself then the official documentation is sometimes a bit hard to understand.
    Anyway yeah, pointless post over.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  9. #9
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    515

    Re: is it possible to code a textbox with automatic complete?

    Yes, but don't you love forums where we come to for human interaction and right enough, you get told off good. Feel free to read the docu, ask questions here and don't take the scolding personally. You will learn by leap years.

  10. #10
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: is it possible to code a textbox with automatic complete?

    People often make the mistake of thinking that I post here to solve people's problems. I don't. I post here to help make people better developers. Telling you the names of the properties you need to use to implement auto-complete in a TextBox may help solve your problem but it's not the best way to become a better developer. You need to learn to pay attention to the IDE that's right in front of you and also to use the Help documentation that is just a couple of clicks away. That is how you become a better developer because you learn where to find the information to solve a great many of the your own problems, and much quicker too. It's YOU who benefit from that. If I can jolt people into helping themselves then I've helped them.

    That said, there are still plenty of problems that will require posting on forums. Heck, I've posted questions myself. It's never the simple ones that only require the use of one method or one property that could be found easily by a quick look in the doco. If you always look first and ask questions later, you'll become a better developer more quickly. You'll also get far more satisfaction from solving problems yourself than having everything done for you.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  11. #11
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    515

    Re: is it possible to code a textbox with automatic complete?

    Quote Originally Posted by jmcilhinney
    If I can jolt people into helping themselves then I've helped them.
    There's a good T-shirt for ya, jmc

    *The Defibrillator*
    Last edited by Xancholy; Jul 19th, 2008 at 10:03 PM.

  12. #12

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    41

    Re: is it possible to code a textbox with automatic complete?

    I went back and checked my program. I found the "automatic list" item in the property window. sorry, it is complete my fault...

    But the realy probelm is I will bother you guys again. Actually, what I want in my program is a little bit different from the "automatic list" function that existed in vb.net

    My Program is a unit converter. it will converter any English unit to SI unit and vice versa. I use textbox control as a container to receive the user's input. Considering user input a unit as "btu/hr". in the first moment the "Automatic List" should show "btu" when "b" is input. Then it should show "hr" when the "h" letter is pressed. Remember the "btu" and "hr" words are stored in the "Automatic List" seperately. In other word "Btu/hr" would not be shown simultaneously in my program, nor they saved as a item in "Automatic List".

    I do not know if my discription is clear or not since english is not my mother tounge.

  13. #13

    Thread Starter
    Member
    Join Date
    Jul 2008
    Posts
    41

    Re: is it possible to code a textbox with automatic complete?

    pump...
    VB.net - A power tool for my engineering life.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width