I want to show the suggested words using autocomplete for the textbox. For instance, i type Tod... all words from my database that starts with "tod" will show but after I chose a word if i type another word like "was" there will be no suggested words below. Probably because the string collection doesn't have "today was". I want to show suggested words that only starts with "was" not "today was". I am attaining to make a project that predicts the most frequent words used. Here is my code
public partial class Form1 : Form
{
string[] arr = new string[] { "sn k", "sn k", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" };
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void txtInput_TextChanged(object sender, EventArgs e)
{
predict();
}
void predict()
{
txtInput.AutoCompleteMode = AutoCompleteMode.Suggest;
txtInput.AutoCompleteSource = AutoCompleteSource.CustomSource;
AutoCompleteStringCollection col = new AutoCompleteStringCollection();
col.AddRange(arr);
txtInput.AutoCompleteCustomSource = col;
}
}
}