Dmitriy Galankin
asked on
AutoComplete doen't work when datagridview created dinamicly
Hello.
1. I has created a datagridview with some textbox cells dinamicly
2. I'm trying to add autocomplete text to cell (it doen't work when datagridview created dinamicly)
Why autocomplete list does not showing?
I'm sorry for my bad english....
1. I has created a datagridview with some textbox cells dinamicly
2. I'm trying to add autocomplete text to cell (it doen't work when datagridview created dinamicly)
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
(e.Control as DataGridViewTextBoxEditingControl).TextChanged -= cell_TextChanged;
(e.Control as DataGridViewTextBoxEditingControl).TextChanged += cell_TextChanged;
}
void cell_TextChanged(object sender, EventArgs e)
{
AutoCompleteStringCollection acCollection = new AutoCompleteStringCollection();
acCollection.Add("1122");
acCollection.Add("1133");
acCollection.Add("1144");
acCollection.Add("1222");
acCollection.Add("1333");
acCollection.Add("1444");
TextBox tb = sender as TextBox;
tb.AutoCompleteSource = AutoCompleteSource.CustomSource;
tb.AutoCompleteCustomSource = acCollection;
tb.AutoCompleteMode = AutoCompleteMode.Suggest;
}
Why autocomplete list does not showing?
I'm sorry for my bad english....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The problem was solved
ASKER
Your collection is formed in OnEditingControlShowing event.
My collection will consist from Russian postal address data (it's very big data)
I need to form a collection in cell_TextChanged event.
So i can form this data and my autoCompleteStringCollecti