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
Prakash Mondal
NA
288
210k
How to use checked and unchecked event in dataGridView?
Oct 6 2018 12:27 PM
I used checkbox in dataGridView.
I want to when I checked then a confirm box will appear, if you choose No then checkbox will unchecked.
my code:
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0)
{
if (Convert.ToBoolean(dataGridView1.Rows[e.RowIndex].Cells["chkBox"].EditedFormattedValue) == true)
{
bool flag = false;
string action = MessageBox.Show("After Process, This Record Will Invalid. Do You Continue?", "Alert!", MessageBoxButtons.YesNo, MessageBoxIcon.Information).ToString().ToString();
if (action == "Yes")
{
flag = true;
}
else if (action == "No")
{
flag = false;
}
if (flag)
{
MessageBox.Show("OKOK");
}
else
{
}
MessageBox.Show("Checked: " );
}
else
{
MessageBox.Show("Un-Checked: ");
}
}
}
And another is when dataGridView is loading then the checkboxes will checked or unchecked depends of a flag.
Please help me.
Reply
Answers (
3
)
how to open .dxf file in C#
error in crystal report at the time of installation