private void btnLocation_Click(object sender, EventArgs e) { frmLocations objfrmLocations = new frmLocations(Instrument.LocationID); objfrmLocations.db = db; objfrmLocations.FormMode = FormMode.Select; objfrmLocations.ShowDialog(); if (objfrmLocations.SelectedLocation != null) {//SP-7 Instrument.Location = objfrmLocations.SelectedLocation; btnLocation.Text = objfrmLocations.SelectedLocation.LocationID; } }
private void dgvInstruments_CellClick(object sender, DataGridViewCellEventArgs e) { Instrument objInstrument = dgvInstruments.CurrentRow.DataBoundItem as Instrument; if (FormMode == FormMode.Edit) if (e.ColumnIndex == dgvInstruments.Columns["btnLocationColumn"].Index) { if (objInstrument != null) { frmLocations objfrmLocations = new frmLocations(objInstrument.LocationID); objfrmLocations.db = db; objfrmLocations.FormMode = FormMode.Select; objfrmLocations.ShowDialog(); if (objfrmLocations.SelectedLocation != null) objInstrument.Location = objfrmLocations.SelectedLocation; } } else if (e.ColumnIndex == dgvInstruments.Columns["btnNotesColumn"].Index) { frmNoteViewer objfrmNoteViewer; if (objInstrument.Note == null) objInstrument.Note = new Note { LastUpdated = DateTime.Now, NoteContent = string.Empty }; objfrmNoteViewer = new frmNoteViewer(objInstrument.Note); objfrmNoteViewer.Show(); } }