Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to create a TextBox that shows the suggestions when i type the first 3 characters. How do i write a code for this scenario?
Posted
Comments
Ganesh Nikam 13-Sep-12 6:14am    
looking for web application or windows

you also can use this code
VB
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If Len(TextBox1.Text) >= 3 Then
            TextBox1.AutoCompleteMode = AutoCompleteMode.Suggest
            TextBox1.AutoCompleteSource = AutoCompleteSource.AllUrl
        Else
            TextBox1.AutoCompleteMode = AutoCompleteMode.None
            TextBox1.AutoCompleteSource = AutoCompleteSource.None
        End If
    End Sub


nice one :)
 
Share this answer
 
Comments
bolshie6 13-Sep-12 5:47am    
how do i use a table from DB as a source for AutoComplete?
Rad.Application 13-Sep-12 6:55am    
fill a dataview with your data and then use this

for i as integer = 0 to dataview1.count - 1
TextBox1.AutoCompleteCustomSource.Add(dataview1(i)("coloumn_name").tostring)
next
Mohamed Mitwalli 13-Sep-12 14:05pm    
5+
Take a look at a similar thread here
Auto complete Textbox in asp.net using ajax and c#[^]

You can convert C# code to VB here[^]
 
Share this answer
 
v2
Comments
Mohamed Mitwalli 13-Sep-12 14:06pm    
5+
__TR__ 14-Sep-12 2:15am    
Thanks Mohamed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900