コード例 #1
0
        private void btnIncluir_Click(object sender, EventArgs e)
        {
            FrmCadastroMoedaEditar frmEdit = new FrmCadastroMoedaEditar();

            frmEdit.ShowDialog();
            CarregarGrid();
        }
コード例 #2
0
        private void grid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && senderGrid.Columns[e.ColumnIndex].Name == "Editar")
            {
                // Editar
                var id = Convert.ToInt32(grid.Rows[e.RowIndex].Cells["Id"].Value);
                FrmCadastroMoedaEditar frmEdit = new FrmCadastroMoedaEditar(id);
                frmEdit.ShowDialog();
                CarregarGrid();
            }

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && senderGrid.Columns[e.ColumnIndex].Name == "Excluir")
            {
                // Excluir
                var id = Convert.ToInt32(grid.Rows[e.RowIndex].Cells["Id"].Value);
                DBMoeda.Excluir(id);
                CarregarGrid();
            }
        }