8
Answers

How to display data on a new instance of an existing form?

Ask a question
Hi,

I'm new to c#.
I am buil

I have a datagrid where that displays a few cells about projects and when the user clicks on a row I want to open a new instance of the projects form and display all the projects info (from a MySQL db).

I'm stuck on how to pass the data to the new instance of the projects form.

The new instance of the form displays ok, but how to reference the original form's text boxes and other objects is the problem I have.

Please help!

below is the line of code:

   public void projectGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //Public String sid;
            //string sid = projectGrid.Rows[projectGrid.CurrentRow.Index].Cells["ID"].Value.ToString();
            project f1 = new project();
            f1.Show();// How to make this form load with the correct data?
        }

Thanks
David


Answers (8)