//button click event for each of the clicks it will open up the respecive form or file from that row private void dgvInvoices_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == dgvInvoices.Columns["View"].Index) { int IDtoPass = int.Parse(dgvInvoices.Rows[e.RowIndex].Cells[1].Value.ToString()); //gets the ID int IDforJob = int.Parse(dgvInvoices.Rows[e.RowIndex].Cells[8].Value.ToString()); //gets the ID JobScreen form = new JobScreen(IDtoPass, IDforJob); form.ShowDialog(); } if (e.ColumnIndex == dgvInvoices.Columns["Payment"].Index) { int IDtoPass = int.Parse(dgvInvoices.Rows[e.RowIndex].Cells[1].Value.ToString()); Payments form = new Payments(IDtoPass); form.ShowDialog(); } if (e.ColumnIndex == dgvInvoices.Columns[6].Index) { System.Diagnostics.Process.Start(@dgvInvoices.Rows[e.RowIndex].Cells[6].Value.ToString()); } } catch (Exception ex) { MessageBox.Show("You tried to click the button that was not in a row with data. \n This is the error: " + ex.Message); } }
///click event for the user to get to the jobscreen and pass on the correct info. private void dgvJobs_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == 6) { int IDtoPass = int.Parse(dgvJobs.Rows[e.RowIndex].Cells[8].Value.ToString()); //gets the Job id int aClientID = int.Parse(dgvJobs.Rows[e.RowIndex].Cells[7].Value.ToString()); //gets the client id JobScreen form = new JobScreen(aClientID, IDtoPass); form.ShowDialog(); } } catch (Exception ex) { MessageBox.Show("You tried to click the button that was not in a row with data. \n This is the error: " + ex.Message); } }
private void btnSelect_Click(object sender, EventArgs e) { JobScreen form = new JobScreen(); form.ShowDialog(); }
// this button will take the user to the ServiceSelect form, allowing them to select a staff member from a dropdown and bringing them to the JobScreen form // for a new job. private void btnNewJob_Click(object sender, EventArgs e) { JobScreen form = new JobScreen(clientID, CreateJob()); form.ShowDialog(); }