I have a datagridview with a checkbox column. I have written some code so that when a row is checked a process happens. However, the code runs fine but doesn't read the specific row which has been checked and instead works its way down each row.
How can I check that a specific row has been checked?
This is my code:
void ViewSignature(DataGridView AllContacts)
{
foreach (DataGridViewRow row1 in AllContacts.Rows)
{
try
{
if (Convert.ToBoolean(row1.Cells[18].Value = true))
{
Process.Start(Properties.Settings.Default.ReferencePoint + @"/Contacts/Contact_" + row1.Cells[0].Value.ToString() + @"/Signature.jpg");
}
return;
}
catch
{
//Error message if the system cannot remove the contact from the database.
MessageBox.Show("Sorry, something went wrong. Please try again later.\n\nERROR CODE: BINSPIRE1009", "BLUEBERRY INSPIRE 2022", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
Please be aware that this is just dummy content and the phone numbers and email addresses are fake.
Once the button above is clicked the process should run.