#region Edit button handling for grvScheduledCourses in "View Scheduled Courses" Tab private void grvScheduledCourses_CellContentClick(object sender, DataGridViewCellEventArgs e) { int currentRow = int.Parse(e.RowIndex.ToString()); try { string courseNoString = grvScheduledCourses[0, currentRow].Value.ToString(); //****Format Error Exception occurs here**** courseNo = int.Parse(courseNoString); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (grvScheduledCourses.Columns[e.ColumnIndex] == btnEdit && currentRow >= 0) { string courseCode = grvScheduledCourses[1, currentRow].Value.ToString(); string StartDate = grvScheduledCourses[2, currentRow].Value.ToString(); string name = grvScheduledCourses[6, currentRow].Value.ToString(); string email = grvScheduledCourses[7, currentRow].Value.ToString(); //runs frmAssignTrainer to edit trainers frmAssignTrainer f2 = new frmAssignTrainer(); f2.courseCode = courseCode; f2.StartDate = StartDate; f2.name = name; f2.email = email; f2.courseNo = courseNo; f2.Show(); grvScheduledCourses.Update(); } } #endregion
courseNo = int.Parse(courseNoString);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)