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
praveen kumar
NA
36
21.2k
Datagridview Cell clear
Aug 8 2015 9:38 AM
Hi Experts,
it's urgent for me
i wrote this code in cell validating but here my problem is
i enter duplicate data delete previous enter data but what i want
which data i enter second time that data delete and cursor focus shoukd be current
cell,
if any body knows please reply me.
Thanks In advance.
private void DGV1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
//DGV1 MY DataGridView Name
for (int i = 0; i < DGV1.Rows.Count; i++)
{
for (int j = 1; j < DGV1.Rows[i].Cells.Count; j++)
{
foreach (DataGridViewRow row in DGV1.Rows)
{
if (row.Index != e.RowIndex & !row.IsNewRow)
{
if(row.Cells[j].Value.ToString() == e.FormattedValue.ToString())
{
DGV1.Rows[e.RowIndex].ErrorText = "Duplicate value not allowed ";
e.Cancel = true;
return;
}
}
}
}
}
}
Reply
Answers (
0
)
Datagridview Cell value clear when enter duplicate value
Datagridview duplicate cell data clear