public frmNewSubject(Form form) { InitializeComponent(); this.form = form; switch (form.Name) { case "frmSubjects": sub = form as frmSubjects; break; case "frmNewClass": newClass = form as frmNewClass; break; case "frmEditClass": editClass = form as frmEditClass; break; } }
private void btnEditClass_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridViewClass.RowCount.Equals(0)) { XtraMessageBox.Show("There is no class(es) to edit", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { for (int x = 0; x < gridViewClass.SelectedRowsCount; x++) { string cid = gridViewClass.GetRowCellValue(gridViewClass.GetSelectedRows()[x], gridColumnCID).ToString(); string className = gridViewClass.GetRowCellValue(gridViewClass.GetSelectedRows()[x], gridColumnClassName).ToString(); string startTime = gridViewClass.GetRowCellValue(gridViewClass.GetSelectedRows()[x], gridColumnTimeStart).ToString(); string endTime = gridViewClass.GetRowCellValue(gridViewClass.GetSelectedRows()[x], gridColumnTimeEnd).ToString(); string subject = gridViewClass.GetRowCellValue(gridViewClass.GetSelectedRows()[x], gridColumnClassSubj).ToString(); frmEditClass editClass = new frmEditClass(cid, className, subject, startTime, endTime, ownerUserlvl, ownerArea); editClass.ShowDialog(); } } }