I use C#.net 2010 and windows form. I have a Datagridview and i want to show the auto complete for the cell when a cell is in edit mode. I show the auto complete suggestion using the code below:
TextBox txt=e.Control as TextBox;
txt.AutoCompleteMode=AutoCompleteMode.Suggest;
txt.AutoCompleteSource=AutoCompleteSource.CustomSource;
AutoCompleteStringCollection clction=new AutoCompleteStringCollection();
txt.AutoCompleteCustomSource=clction;
clction.add("this string ");
the autocomplete works fine but I want to show the auto complete value for a Column each time. the auto complete text is too long and if user starts to type different chars the auto complete goes away. but i want to show the suggestion in a way that is not related to the typed text. First i thought i should put a textbox element and change the position of element each time the user starts typing but it did not worked good for my purpose. So what are the alternatives here?
Aucun commentaire:
Enregistrer un commentaire