private void button4_Click(object sender, EventArgs e) { int id = rs.getLastId(); sz = new Szerk(id); sz.ShowDialog(); if (sz.DialogResult == DialogResult.OK) { try { dataGridView1.DataSource = null; dataGridView1.DataSource = sz.addNewItem(); } catch (Exception d) { return; } } }
private void button2_Click(object sender, EventArgs e) { try { if (dataGridView1.SelectedRows.Count > 1) { dataGridView1.ClearSelection(); return; } bool teg = false; if (dataGridView1.SelectedRows[0].Cells[8].Value.ToString() == "True") { teg = true; } MdTermekek termekek = new MdTermekek( Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()) , dataGridView1.SelectedRows[0].Cells[1].Value.ToString() , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[2].Value.ToString()) , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[3].Value.ToString()) , dataGridView1.SelectedRows[0].Cells[4].Value.ToString() , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[5].Value.ToString()) , Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[6].Value.ToString()) , Convert.ToDateTime(dataGridView1.SelectedRows[0].Cells[7].Value.ToString()) , teg); sz = new Szerk(termekek); sz.ShowDialog(); if (sz.DialogResult == DialogResult.OK) { try { dataGridView1.DataSource = null; dataGridView1.DataSource = sz.raktnak(); } catch (Exception d) { } /*rs.modifyData(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()), termekek);*/ } } catch (Exception a) { MessageBox.Show("nem jelöltél ki semmit"); button1_Click(sender, e); } }