Re: How to make Seach in the TextBox as it did in Google TextBox
You could do something like
Code:
Try
'Get the values from Database and Add in the Collection
Dim aCol As New AutoCompleteStringCollection
aCol.Add("Line1")
aCol.Add("vbforums.com")
TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
TextBox1.AutoCompleteCustomSource = aCol
TextBox1.AutoCompleteMode = AutoCompleteMode.Suggest
Catch ex As Exception
End Try
Please mark you thread resolved using the Thread Tools as shown
Re: How to make Seach in the TextBox as it did in Google TextBox
is the data that you want to be in the auto complete source is from database??
or from a control.
if the data is from a combo box then it will be like this
Code:
TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
TextBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend
For x As Integer = 0 To 100
ComboBox1.Items.Add(x)
TextBox1.AutoCompleteCustomSource.Add(ComboBox1.Items(x))
Next
Re: How to make Seach in the TextBox as it did in Google TextBox
Originally Posted by snakeman
is the data that you want to be in the auto complete source is from database??
or from a control.
if the data is from a combo box then it will be like this
Code:
TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
TextBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend
For x As Integer = 0 To 100
ComboBox1.Items.Add(x)
TextBox1.AutoCompleteCustomSource.Add(ComboBox1.Items(x))
Next
if else please tell us.
hope this helps
In wich event of TextBox I must to insert this code?
Re: How to make Seach in the TextBox as it did in Google TextBox
I tried the code in last previous in post #9, and it worked well with me.
I created database Ms access called "DataBaseName" with Table1 including three fileds:Name,Place,Mobile.
I inserted this code in the Form load to search the data in DataBaseName in filed "Name", but I don't know how to complete it. May help please.
Re: How to make Seach in the TextBox as it did in Google TextBox
Originally Posted by nader
I tried the code in last previous in post #9, and it worked well with me.
I created database Ms access called "DataBaseName" with Table1 including three fileds:Name,Place,Mobile.
I inserted this code in the Form load to search the data in DataBaseName in filed "Name", but I don't know how to complete it. May help please.
first where is oledbcommand ???????????????/
second why you put 100 in the loop????
third why do you open and close the connection
you are not dealing with the db directly actually you are dealing with the dataset so you don't need to open and close the connection in this point
because when the adapter filled the dataset the adapter automatically opened and closed the connection
fourth what is this????????????
Re: How to make Seach in the TextBox as it did in Google TextBox
It has succedd with me, but the first one (where the values are written in the combobox), when I load the form where I inserted the code it didn't show the data in the textbox only when I write in the textbox, but in this code ( where the values is written in the Db), whe I load the form it show the first values in the textbox how can I make it like previous code.
Re: How to make Seach in the TextBox as it did in Google TextBox
Here is a pic
the frist one it show the text imeadiatley in the texbox( which use the code in the post #13), the second( which use the code in the post #9), it didn't show the text only after write in the textbox.