in my datagridview i waant to give auto suggetion to only particular column example say com

Jun 15 2012 8:35 AM
In my datagridview i want to give auto suggestion to only particular column example say columnindex 2 and 4 for that i had write my code like this...


if (dgv1.CurrentCell.ColumnIndex == 2 || dgv1.CurrentCell.ColumnIndex == 4)
{
                    TextBox txt = e.Control as TextBox;
                    txt.AutoCompleteCustomSource = acnamescoll;
                    txt.AutoCompleteMode = AutoCompleteMode.Suggest;
                    txt.AutoCompleteSource = AutoCompleteSource.CustomSource;
}
but this is applying to every cell after the columnindex which i specified in this condition.

how can i over come this problem?
thanks in advance...



Answers (2)