当我选择一行但 dataGridView1_CellClick 事件未触发时触发 dataGridView1_SelectionChanged 事件。我只使用一个网格。
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
{
}
}
}
上述事件正确触发。但下面提到的事件不会触发。
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;
}
}