1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
//Chaine permettant de ramener les éléments de ma requéte.
string[] suggestions = { };
private void t_numdeco_TextChanged(object sender, EventArgs e)
{
if (!textChanging)
{
textChanging = true;
string prefix = "";
string text = t_numdeco.Text;
bool changed = false;
if (lastText.Length < text.Length && text.EndsWith(" "))
{
prefix = text;
changed = true;
}
else if (lastText.Length < text.Length && lastText.EndsWith(" ") && text.Contains(" "))
{
prefix = text.Substring(0, text.LastIndexOf(' '));
changed = true;
}
if (changed)
{
autoComplete.ReleaseAutoComplete();
autoComplete = new CustomSource(suggestions.Where(t => !prefix.Split().Contains(t)).Select(t => prefix + t).ToArray());
autoComplete.Bind(t_numdeco);
}
textChanging = false;
} |
Partager