Hi!
I have a record open in a datagrid on one form; I'd like to move on and open another form with the same record appearing (this time with the fields as labels). What's the most efficient way to do this For example, copying the field values into a struct and passing it in the constructor of the new form, then using these values searching for the record on the new form using a new datasource attached to the table seems cumbersome...
Thank you in advance for elegant advice!
John F.

Keeping data table open on same record on new form
lukeliu
You can have a public method in your other form that takes in a DataRow object. Then you can use that datarow object to populate your labels...
// your form to display the rows values in labels (Form1)
public void getRow(DataRow dr) {
// place logic here to populate the labels
}
// on your form where your datatable is (a datatable is your datagrid's datasource)
Form1 frm1 = new Form1();
frm1.getRow(yourDataTable.Rows[idx]);
cheers,
Paul June A. Domag
Kajal Sinha
John F.