dataGridView1_SelectionChanged event fire when i select a row but dataGridView1_CellClick event is not firing. I am using one grid only.
private void mgInvoice_SelectionChanged(object sender, EventArgs e)
{
if (this.IsFlagForShowImage)
{
////If show image flag is true then only show images for invoices.
try
{
if (this.mgInvoice.SelectedRows != null)
{
if (this.mgInvoice.SelectedRows.Count > 0)
{
invoice = this.mgInvoice.SelectedRows[0].DataBoundItem as TAPInvoice;
Thread th = new Thread(new ThreadStart(LoadDocumentIdByInvoice));
th.Start();
this.ShowInvoiceImageDocumentByDocId(this.invoice);
IsModifiedCollection = true;
//Zahid
this.SetPriviliges();
}
}
}
catch
{
throw;
}
finally
{
}
}
}
the above event fire correctly. but below mention event does not fire.
private void mgInvoice_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (this.mgInvoice.Columns["FImagesReviewed"].Visible)
{
this.mgInvoice.Columns["FImagesReviewed"].Visible = true;
}
else if (this.mgInvoice.Columns["FImagesApproved"].Visible)
{
this.mgInvoice.Columns["FImagesApproved"].Visible = true;
}
}
I had the same problem. There was an assignment to the CurrentCell of the DataGridView in the SelectionChanged event handler:
_DataGridView.CurrentCell = cellToSelect;
After I removed this assignment the CellClick event was fired again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.