private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.RowIndex < dataGridView1.Rows.Count - 1) { string imeColumne = dataGridView1.Columns[e.ColumnIndex].Name; if (imeColumne == "pretplate") { string ime = dataGridView1.Rows[e.RowIndex].Cells["ime"].Value.ToString(); string prezime = dataGridView1.Rows[e.RowIndex].Cells["prezime"].Value.ToString(); string mbg = dataGridView1.Rows[e.RowIndex].Cells["mbg"].Value.ToString(); int id; int.TryParse(dataGridView1.Rows[e.RowIndex].Cells["id"].Value.ToString(), out id); Form frm = new Pretplate(ime, prezime, id, mbg); frm.ShowDialog(this); } else if (imeColumne == "azuriraj") { int id; int.TryParse(dataGridView1.Rows[e.RowIndex].Cells["id"].Value.ToString(), out id); Pretplatink frm = new Pretplatink(id); DialogResult rez = frm.ShowDialog(this); if (rez == DialogResult.OK && frm.PretplatnikID > 0) { Form frmPretplate = new Pretplate(frm.Ime, frm.Prezime, frm.PretplatnikID, frm.MBG); frmPretplate.ShowDialog(this); } } } }
private void stripPretplatnici_Click(object sender, EventArgs e) { Pretplatink frm = new Pretplatink(); DialogResult rez = frm.ShowDialog(this); if (rez == DialogResult.OK && frm.PretplatnikID > 0) { Form frmPretplate = new Pretplate(frm.Ime, frm.Prezime, frm.PretplatnikID, frm.MBG); frmPretplate.ShowDialog(this); } }