private void Button2_Click(object sender, EventArgs e) { if (colunaSelecionada != null) { frmEditarEditoras editar = new frmEditarEditoras(); editar.edicao = colunaSelecionada; editar.ShowDialog(); } else { MessageBox.Show("Selecione um registro para alterar"); } }
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var editoraSelect = ((System.Data.DataRowView) this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row as MVCProject.SistemaBibliotecaDBDataSet.EditorasRow; switch (e.ColumnIndex) { case 0: { frmEditarEditoras editEditora = new frmEditarEditoras(); editEditora.EditorasRow = editoraSelect; editEditora.ShowDialog(); this.editorasTableAdapter.UpdateQuery( editEditora.EditorasRow.Nome, editEditora.EditorasRow.Descricao, editEditora.EditorasRow.Id); } break; } this.editorasTableAdapter.CustomQuery(this.sistemaBibliotecaDBDataSet.Editoras); }