troubleshooting Question

DatagridView Column Double Click

Avatar of thecruz
thecruz asked on
C#
2 Comments1 Solution1482 ViewsLast Modified:
I'm fairly new at working with datagrids and this problem is bugging the hell out of me. Can someone please lead me in the right direction as to how to prevent a user from double clicking a column header. The following code reflects what is supposed to happen when the user double clicks the grid,but i get a massive error when people double click on the column headers:

CellToDelete = dtgFE1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString();

string Message = "Do you want to delete this record?";
string caption = "Notice";
DialogResult result;

result = MessageBox.Show(Message, caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (result == DialogResult.OK)
{
SystemDeleteRecord();
}
if (dtgFE1.DataSource != null)
{
dtgFE1.DataSource = RetrieveDataGridsData.GetFEData1();
dtgFE1.DataMember = "System";
}
else
{
MessageBox.Show("There are no more records associated with this call");
}

Any help would absutely be appreciated.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros