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
Ranjit Powar
295
6.3k
1.5m
Autocomplete for column not working
Apr 28 2014 7:42 AM
I use following code for autocomplete first column but its not working plz help?
private void dgvInovce_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (this.dgvInovce.CurrentCell.ColumnIndex == 0)
{
TextBox tb = e.Control as TextBox;
if (tb != null)
{
AutoCompleteStringCollection str = new AutoCompleteStringCollection();
str.Add("A");
str.Add("B");
tb.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
tb.AutoCompleteCustomSource = str;
tb.AutoCompleteSource = AutoCompleteSource.CustomSource;
}
txtDgvQuntity = e.Control as TextBox;
txtDgvSaleRate = e.Control as TextBox;
txtDgvDiscount = e.Control as TextBox;
txtDgvQuntity.KeyPress -= new KeyPressEventHandler(txtDgvQuntity_KeyDown);
txtDgvSaleRate.KeyPress -= new KeyPressEventHandler(txtDgvSaleRate_KeyDown);
txtDgvDiscount.KeyPress -= new KeyPressEventHandler(txtDgvDiscount_KeyDown);
if (this.dgvInovce.CurrentCell.ColumnIndex == 1)
{
txtDgvQuntity.KeyPress += new KeyPressEventHandler(txtDgvQuntity_KeyDown);
}
if (this.dgvInovce.CurrentCell.ColumnIndex == 3)
{
txtDgvSaleRate = e.Control as TextBox;
if (txtDgvSaleRate.Text.Trim().Length > 0)
txtDgvSaleRate.Clear();
txtDgvSaleRate.KeyPress += new KeyPressEventHandler(txtDgvSaleRate_KeyDown);
}
if (this.dgvInovce.CurrentCell.ColumnIndex == 4)
{
txtDgvDiscount = e.Control as TextBox;
txtDgvDiscount.KeyPress += new KeyPressEventHandler(txtDgvDiscount_KeyDown);
}
}
}
Reply
Answers (
0
)
pls can u provide information regarding how to update table
C#