I have a textbox which sends some commands to an instrument. I added the AutoComplete feature to this textbox and things are going easier now.
What I am thinking to improve this, is to add a possibility that when user enters a command (just a text) while AutoComplete finds a match it also shows a description for that command.
At the moment, I have all the AutoComplete strings in a text file and I load it when the application starts. The textfile contains lines like this:
*IDN? #Query the instrument for identification
*RST #Resets the instrument
So what is happening in my application is that because AutoComplete is in SuggestAppend mode, the description of command also gets into the textbox (this will be the same if I only put it in Suggest mode)
What I need to know is how to force the AutoComplete to append the text while its
- Does not add any text starting from
#char while appending the suggested text - Trim() the text to avoid that spaces you see in the textfile source
UPDATE 1
Ok, I think the only way is to make a new class and inherit from AutoCompleteStringCollection And in this new class, somehow override the reponsible method for returning (appending) suggested text. I really have no idea what should I do:
class MyAutoCompleteCollection : AutoCompleteStringCollection
{
//How to override Get function of AutoCompleteStringCollection class?
//It is not avilable to override :(
}
UPDATE 2
I found out that methods in AutoCompleteStringCollectionare not overridable. I am looking for a way to change the way the [] method (to be honest I do not know what to call it!) works. Does someone have any idea about this?

UPDATE 3
When the text without #DESC goes into the textbox, I have a event handler for KeyDown which will transfer the command to the instrument.
Rather than trying to battle the autocomplete functionality that Microsoft has implemented, I strongly suggest that you use a multi-column combobox instead.
All of the ones that we have used support auto-completion, so you can store your command in the first column and have it be your value and then store your description in the second column.
There are a tremendous number of controls available for purchase (Infragistics, Intersoft, Syncfusion, etc) and you can probably find free or self-built versions on various sites such as CodeProject.
Going this route should save you a lot of time.