GBs GBs - 2 months ago 29
C# Question

Autocomplete textbox in layered architecture

I want to create an autocomplete

with my database.

I'm programming my application in a layered architecture (models, DAL, BLL, Presentation).

I've already made a method with an
that reads and returns my select command in the database, which is filling (I've tested on a

But when I try to insert in the the
, nothing happens... it doesn't show the suggestion.

I looked for something in the forum but I just found examples with one layer and, since I'm developing in layers I cannot increment the property
in my
to be filled by my select command.

If anyone has any idea how to solve this problem, please explain to me!

Additional information: I'm using
with C# and SQL Server.


I think you want to say that "But when i try to insert in the textbox, nothing happens... it doesn't show the sugestion." well i cannot just code all layers here but can suggest in your DAL create a method which returns List and then on your form page provide code like this

 txtName.AutoCompleteMode = AutoCompleteMode.Suggest;
 txtName.AutoCompleteSource = AutoCompleteSource.CustomSource;
 var autoCompleteCollection = new AutoCompleteStringCollection();
 textbox.AutoCompleteCustomSource = autoCompleteCollection;