private void btnAlterar_Click(object sender, EventArgs e) { operacao = operacao.alterar; HabilitarCampos(); txtNome.Text = dgvDados.Rows[dgvDados.SelectedRows[0].Index].Cells[1].Value.ToString(); txtDescricao.Text = dgvDados.Rows[dgvDados.SelectedRows[0].Index].Cells[2].Value.ToString(); }
private void btnPesquisar_Click(object sender, EventArgs e) { operacao = operacao.pesquisar; HabilitarCampos(); txtDescricao.Enabled = false; //txtNome.Enabled = false; //txtCod.Enabled = true; //txtCod.Focus(); }
{ public static void Executar() { operacao sum = (x, y) => x + y; operacao sub = (x, y) => x - y; operacao mult = (x, y) => x * y; Console.WriteLine(sum(3, 3)); Console.WriteLine(sub(5, 2)); Console.WriteLine(mult(3, 3)); }
public static void Executar() { operacao subtracao = (int x, int y) => x - y; // instanciando Console.WriteLine(Calculadora(subtracao, 3, 2)); //somando Console.WriteLine(Calculadora(Soma, 3, 2)); //multiplicando Console.WriteLine(Calculadora(multiplicar, 2, 5)); }
static void Main() { int res; operacao cp1 = new operacao(Mat.soma); res = cp1(10, 15); Console.WriteLine(res); cp1 = new operacao(Mat.mult); res = cp1(15, 20); Console.WriteLine(res); }
private void btnIncluir_Click(object sender, EventArgs e) { operacao = operacao.incluir; HabilitarCampos(); }
public static string Calculadora(operacao op, int x, int y) { var resultado = op(x, y); return("resultado " + resultado); }