This is a migrated thread and some comments may be shown as answers.

AutoComplete on TextBox?

7 Answers 299 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Josh Anderson
Top achievements
Rank 1
Josh Anderson asked on 02 May 2008, 08:47 PM
As I'm sure you can tell by my recent posts, I've been playing around with the controls for Windows Forms, and I noticed today that the RadTextBox does not include an ability to bind to an autocomplete source like the standard TextBox does.  Is there another way to accomplish this?  One of my RadTextBox controls is for URL entry, and I'd like the option to tie it to the user's history for autocomplete.

Josh

7 Answers, 1 is accepted

Sort by
0
Accepted
Kiril
Telerik team
answered on 05 May 2008, 07:54 AM
Hello Josh Anderson,

Thank you for writing.

The Autocomplete functionality is available witin the RadTextBox. This example shows how to access it, via a simple example. Please refer to the code-segment below:

            TextBox tb = ((TextBox)((RadTextBoxItem)radTextBox1.RootElement.Children[0].Children[0]).HostedControl);  
            tb.AutoCompleteCustomSource.AddRange(new string[] {  
            "blabla",  
            "mlamla",  
            "clacla"});  
            tb.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append;  
            tb.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource; 

Thank you for directing our attention to this functionality. In the upcoming service pack, this functionality will be available at the top-level of the control. There will be no difference in the way you would use a Microsoft TextBox and a Telerik RadTextBox with respect to this functionality.

If you have any additional questions, let us know. We'd love to help you get acquainted with what our product has to offer.

All the best,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ryan
Top achievements
Rank 1
answered on 20 Aug 2008, 04:41 PM
Would you be willing to post the VB version of this?

Ryan
0
Ryan
Top achievements
Rank 1
answered on 20 Aug 2008, 07:52 PM
Nevermind.

Got it worked out....

Dim

tb As TextBox

tb =

DirectCast(DirectCast(tb_City.RootElement.Children(0).Children(0), RadTextBoxItem).HostedControl, TextBox)

0
jamsheer
Top achievements
Rank 1
Veteran
answered on 16 Apr 2021, 12:19 PM

Hi telerik,

     How to filter radtextbox (autocomplete Mode) like "Contains mode"

Regards,

Jamsheer

0
Nadya
Telerik team
answered on 16 Apr 2021, 12:41 PM

Hello, jamsheer,

In order to activate "contains" autocomplete functionality in RadTextBox, you can set the AutoCompleteMode property to AutoCompleteMode.Suggest:

TextBox tb = ((TextBox)((RadTextBoxItem)radTextBox1.TextBoxElement.TextBoxItem).HostedControl);
tb.AutoCompleteCustomSource.AddRange(new string[] {
"blabla",
"mlamla",
"clacla"});
tb.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
tb.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;

In addition, I would like to note that Telerik UI for Winforms suite offers RadTextBoxControl as well that supports auto complete functionality out of the box: https://docs.telerik.com/devtools/winforms/controls/editors/textboxcontrol/autocomplete 

I hope this helps. Let me know if you have further questions.

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
jamsheer
Top achievements
Rank 1
Veteran
answered on 17 Apr 2021, 05:03 AM

Hi Nadya, 

    Thank u for u r Fast reply.

    I done with your code with new radtextbox, But Its working startswith  but contains is not working when filtering.

I attached a gif file of my work,

If working there pls give me a sample project

Thank you 

jamsheer

0
Nadya
Telerik team
answered on 19 Apr 2021, 01:36 PM

Hello, jamsheer,

The default values of AutoCompleteMode that RadTextBox and RadTextBoxControl offers are: Append, Suggest, and SuggestAppend. When you choose Suggest option the auto-complete functionality searches for the exact match that starts with the typed character. According to your requirement, you need to search within the whole text for a word that contains a specified character. 

In this case, I would recommend referring to the following KB article that demonstrates how you can create a custom RadTextBoxControl: https://docs.telerik.com/devtools/winforms/knowledge-base/textboxcontrol-autocomplete-contains. I believe this would fit your scenario.

I hope this helps. Should you have further questions please let me know.

Regards,
Nadya
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Tags
TextBox
Asked by
Josh Anderson
Top achievements
Rank 1
Answers by
Kiril
Telerik team
Ryan
Top achievements
Rank 1
jamsheer
Top achievements
Rank 1
Veteran
Nadya
Telerik team
Share this question
or