private void DgItensFormaPagamento_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { int rowindex = e.RowIndex; if (FORMAPAGAMENTOColl.Count > 0 && rowindex > -1) { int ColumnSelecionada = e.ColumnIndex; int CodSelect = -1; if (ColumnSelecionada == 0)//Editar { CodSelect = Convert.ToInt32(ITENSFORMAPAGTOColl[rowindex].IDITENSFORMAPAGTO); Entity2 = ITENSFORMAPAGTOP.Read(CodSelect); } else if (ColumnSelecionada == 1)//Excluir { DialogResult dr = MessageBox.Show(ConfigMessage.Default.MsgDelete, ConfigSistema1.Default.NameSytem, MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { try { CodSelect = Convert.ToInt32(ITENSFORMAPAGTOColl[rowindex].IDITENSFORMAPAGTO); ITENSFORMAPAGTOP.Delete(CodSelect); GetItensFormaPagamento(); Entity2 = null; Util.ExibirMSg(ConfigMessage.Default.MsgDelete2, "Blue"); } catch (Exception) { MessageBox.Show(ConfigMessage.Default.MsgDeleteErro); } } } } }