I am creating a C# application to user for my brother in his store.
I have a SQL Server database that stores all sold items, The items are added from the application.
When the user enters text in the ‘CustomerName’ field in the application, i want it to do a DB call and check for any previous sales with the same customer name (or what has been typed of the name so far) and fill in the text box will the name.
The problem i am having is: if there is a customer called John and another called Joe and i need to select John, if i type in J in the box, it will just select Joe, and then return the text cursor to the beginning of the text box which is rather annoying and inconvenient.
The ideal solution would be is if i type J in the textbox, a dropdown box just below the text box would appear displaying all the Customers with J, allowing the user to select a customer and then filling in the textbox with the value. If i then type Jo, all the records for Jo would appear in the dropdown etc.
The coding part shouldn’t be a problem (hopefully), i just wanted to know the best way to approach this.
First add/change these properties in your textbox
then you could use this method to get a List of customer names that start with your prefix.
As a safeguard I will check if the text typed in your combobox is at least three chars