private void dgvPoruke_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { var poruka = dgvPoruke.SelectedRows[0].DataBoundItem as StudentiPoruke; if (e.ColumnIndex == 3) { if (MessageBox.Show("Da li ste sigurni da želite obrisati poruku?", "Upozorenje", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { _db.StudentiPoruke.Remove(poruka); _db.SaveChanges(); } } else { frmNovaPorukaIB150051 frmNovaPorukaIB150051 = new frmNovaPorukaIB150051(_student, poruka); frmNovaPorukaIB150051.ShowDialog(); } UcitajPoruke(); } catch (Exception ex) { MessageBox.Show($"{ex.Message}{Environment.NewLine}{ex.InnerException?.Message}"); } }
private void btnNovaPoruka_Click(object sender, EventArgs e) { frmNovaPorukaIB150051 frmNovaPorukaIB150051 = new frmNovaPorukaIB150051(_student); if (frmNovaPorukaIB150051.ShowDialog() == DialogResult.OK) { UcitajPoruke(); } }