Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

C# DataGridView Open New Form on row click

$
0
0

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);
        }

I'm 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


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>