C# DataGridView Open New Form on row click

  • Thread starter Thread starter TParky
  • Start date Start date
T

TParky

Guest
Hi Guys,

I have an application which has a DataGridView with some data in it. How can I set it up so that when a user click on a row in the DataGridView it Opens a new Form and passes the ID from column 1 to the new form.

I have the following code that is allowing me to click the row.

private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
{
/*
* Replace the MessageBox command with the following code block.
* SubApps.UpdateTicket updateTicketForm = new SubApps.UpdateTicket();
* updateTicketForm.Show();
*
*/
MessageBox.Show("You Clicked", "Row Click Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}


Im not sure how to get the information from the Selected row and pass it to the new form.

Any suggestions would be excellent.

Kind Regards


TPark IT Technician

Continue reading...
 
Back
Top