TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
alaa
NA
166
84.9k
gridview autocomplete windows application c#
May 9 2015 6:59 AM
i have agridview i hope to make auto complete for only one colum but it works with all row cells all the cells are textbox i use that code
<pre lang="c#"> public AutoCompleteStringCollection AutoCompleteLoad()
{
AutoCompleteStringCollection str = new AutoCompleteStringCollection();
foreach (DataRow row in dt.Rows)
{
str.Add(Convert.ToString(row[1]));
}
return str;
}
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
int column = dataGridView1.CurrentCell.ColumnIndex;
string headerText = dataGridView1.Columns[1].HeaderText;
if (headerText.Equals("pro"))
{
TextBox tb = e.Control as TextBox;
if (tb != null)
{
tb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
tb.AutoCompleteCustomSource = AutoCompleteLoad();
tb.AutoCompleteSource = AutoCompleteSource.CustomSource;
}
}
}</pre>
i make to only only column but still work with all cells how can i solve it ?
Reply
Answers (
2
)
How can I turn into a good developer C#
how to add date column to get dates