private void gvJobHistory_CellClick(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; //Get row index Job modifyJob = new Job(); if (index >= 0)// Checks if user clicked on top left box { DataGridViewRow selectedRow = gvJobHistory.Rows[index]; if (!DBNull.Value.Equals(selectedRow.Cells[0].Value))// If custID DBnulls, then an empty row was selected... create new job { modifyJob.CustID = Convert.ToInt32(selectedRow.Cells[0].Value); modifyJob.JobID = Convert.ToInt32(selectedRow.Cells[1].Value); modifyJob.Job_Title = selectedRow.Cells[2].Value.ToString(); modifyJob.Start_Date = Convert.ToDateTime(selectedRow.Cells[3].Value); modifyJob.End_Date = Convert.ToDateTime(selectedRow.Cells[4].Value); modifyJob.Salary = Convert.ToInt32(selectedRow.Cells[5].Value); } else { modifyJob.CustID = Convert.ToInt32(currentApplicant); } addModifyJob modifyJobForm = new addModifyJob(); modifyJobForm.job = modifyJob; modifyJobForm.initializeForm(); modifyJobForm.Show(); } }
private void btnAddJob_Click(object sender, EventArgs e) { addModifyJob newJob = new addModifyJob(); }