private void btnAlt_Click(object sender, EventArgs e) { if (dgvData.CurrentRow == null) { MessageBox.Show("Nenhum Item Selecionado", "Aviso"); } else { if (MessageBox.Show("Deseja Alterar\n" + dgvData.CurrentRow.Cells[1].Value.ToString() + "? ", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { modItens Tela = new modItens(); Tela.cod = dgvData.CurrentRow.Cells[0].Value.ToString(); Tela.descricao = dgvData.CurrentRow.Cells[1].Value.ToString(); Tela.cor = dgvData.CurrentRow.Cells[2].Value.ToString(); Tela.tamanho = dgvData.CurrentRow.Cells[3].Value.ToString(); Tela.categoria = dgvData.CurrentRow.Cells[4].Value.ToString(); Tela.tipo = dgvData.CurrentRow.Cells[5].Value.ToString(); Tela.preco = dgvData.CurrentRow.Cells[6].Value.ToString(); Tela.quan = Convert.ToInt32(dgvData.CurrentRow.Cells[7].Value); Tela.imagem = dgvData.CurrentRow.Cells[8].Value.ToString(); Tela.txtCod.Enabled = false; Tela.label2.Text = "Alterar"; Tela.btnNovo.Enabled = true; Tela.alterar = 1; Tela.ShowDialog(); } } }
private void btnAdd_Click(object sender, EventArgs e) { modItens Tela = new modItens(); Tela.ShowDialog(); }