private void button1_Click(object sender, EventArgs e) { try { int valor = int.Parse(clientedgv[0, clientedgv.CurrentRow.Index].Value.ToString()); string nome = clientedgv[1, clientedgv.CurrentRow.Index].Value.ToString(); string morada = clientedgv[2, clientedgv.CurrentRow.Index].Value.ToString(); string codpostal = clientedgv[3, clientedgv.CurrentRow.Index].Value.ToString(); string localidade = clientedgv[4, clientedgv.CurrentRow.Index].Value.ToString(); string nif = clientedgv[5, clientedgv.CurrentRow.Index].Value.ToString(); string data = clientedgv[6, clientedgv.CurrentRow.Index].Value.ToString(); string genero = clientedgv[7, clientedgv.CurrentRow.Index].Value.ToString(); string altura = clientedgv[8, clientedgv.CurrentRow.Index].Value.ToString(); string telemovel = clientedgv[9, clientedgv.CurrentRow.Index].Value.ToString(); string email = clientedgv[10, clientedgv.CurrentRow.Index].Value.ToString(); string email2 = clientedgv[11, clientedgv.CurrentRow.Index].Value.ToString(); string datainsc = clientedgv[12, clientedgv.CurrentRow.Index].Value.ToString(); string tipopagamento = clientedgv[13, clientedgv.CurrentRow.Index].Value.ToString(); string valormonetario = clientedgv[14, clientedgv.CurrentRow.Index].Value.ToString(); string observacoes = clientedgv[15, clientedgv.CurrentRow.Index].Value.ToString(); FrmInserirCliente janela = new FrmInserirCliente("editar", nome, morada, codpostal, localidade, nif, data, genero, altura, telemovel, email, email2, datainsc, tipopagamento, valormonetario, observacoes, valor); janela.ShowDialog(); } catch (Exception ex) { MessageBox.Show("Ocorreu o seguinte erro: " + ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btinserir_Click_1(object sender, EventArgs e) { try { FrmInserirCliente janela = new FrmInserirCliente("novo"); janela.ShowDialog(); } catch (Exception ex) { MessageBox.Show("Ocorreu o seguinte erro: " + ex.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }