Windows Develop Bookmark and Share   
 index > Windows Forms General > Custom source from database to autocomplete textbox
 

Custom source from database to autocomplete textbox

Hi there
I did an English/Hebrewdictionary reading from a database. It is working great. I wanted to make the textbox an autocomplete txtbox using a column in the db as a custom source. It is working but only about 300 words are found in the autocomplete. I tried the following several codes below but the results are the same: only about 300 words:

Try
While reader.Read

TextBox1.AutoCompleteCustomSource.Add(reader(0))

End While
******************************
Do Until (reader.Read()) = False
Me.TextBox1.AutoCompleteCustomSource.Add(reader.GetString(0))
Loop
******************************
Do While (reader.Read = True)
TextBox1.AutoCompleteCustomSource.Add(reader.GetString(0))
Loop
******************************
While Not (reader.Read()) = False
Me.TextBox1.AutoCompleteCustomSource.Add(reader.GetString(0))
End While
******************************
End Try

Is there a way that the reader reads the whole DB. The db consists of more 6000 words
I appreciate any help so that I can enjoy the weekends since I have been trying for a whole month now.
Thank you so much

bassem12  Friday, March 27, 2009 5:48 PM

Hi Bassem,

The MSDN document describing the TextBox.AutoCompleteCustomSource property says:

The operating system might limit the number of custom strings that it can display at once.

So it seems that the auto complete custom source of the TextBox on your machine is limited to 300 strings. I suggest that you use another control, e.g. ComboBox or ListBox instead of the TextBox control on your form. Or you can add a button behind the TextBox. When the button is clicked, a form pops up showing all dictionary items in it.

Hope this helps.
If you have any question,please feel free to let me know.

Sincerely,
Linda Liu

Linda Liu  Wednesday, April 01, 2009 10:18 AM

Hi Bassem,

The MSDN document describing the TextBox.AutoCompleteCustomSource property says:

The operating system might limit the number of custom strings that it can display at once.

So it seems that the auto complete custom source of the TextBox on your machine is limited to 300 strings. I suggest that you use another control, e.g. ComboBox or ListBox instead of the TextBox control on your form. Or you can add a button behind the TextBox. When the button is clicked, a form pops up showing all dictionary items in it.

Hope this helps.
If you have any question,please feel free to let me know.

Sincerely,
Linda Liu

Linda Liu  Wednesday, April 01, 2009 10:18 AM
thank you. Your reply was very helpful
Thank you so much
bassem12  Friday, April 10, 2009 8:24 PM
Miss Linda
I really appreciate your help.

I need a textbox that has an autocomplete custom source from a database. I can connect the textbox to the database. Under the textbox there is a listbox that lists all the words of a database (one column). The database contains about 5000 words. I also was able to connect the listbox to the database. What I need is that when I start tying in the textbox words are selected and highlighted in the list box until I can see the right word in the listbox before completing it, then I click or double click the word in the listbox then it appears in the textbox. This is “suggesting�a word from the autocomplete custom source (the database)
i don't know what I did exactly but I was able to get the whole words (5000 word) to display in a listbox.

Can you help me here please
bassem12  Friday, April 10, 2009 8:46 PM

You can use google to search for other answers

Custom Search

More Threads

• Dotfuscator and localized forms
• Higher Performance Option To Web Services
• I want a Report Control .Net, NOT Crystal
• Big buttons toolstrip
• ViewState
• custom shaped forms
• Can it be done in a Windows form vb.net?
• Stored Procedure Failure
• Opening a .chm file from a menu item
• Load a exe as a MDI child