I have exhaustively researched (googled) a solution to this problem, but can find none. My problem is that upon selecting a row in Form1 (Called that for clarity) it does not transfer the values to the DataGridView
in Form2. Mind you, all the column headers are transferred.
Here is a snippet of Form1:
private void customersDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
{
OrderSearchForm orderform = new OrderSearchForm();
orderform.Row = this.customersDataGridView.CurrentRow;
orderform.MdiParent = this.MdiParent;
orderform.Show();
}
And Form2:
private DataGridViewRow row;
public DataGridViewRow Row
{
get { return row; }
set { row = value; }
}
private void OrderSearchForm_Load(object sender, EventArgs e)
{
NorthwindDataClassesDataContext db = new NorthwindDataClassesDataContext();
DataGridViewRow r = row.Clone() as DataGridViewRow;
foreach (DataGridViewCell cell in row.Cells)
{
this.OrderSearchgridview.Columns.Add(cell.OwningColumn.Name,
cell.OwningColumn.HeaderText);
r.Cells[cell.ColumnIndex].Value = cell.Value;
}
OrderSearchgridview.Rows.Add(r);
}
So basically, my question is, how do I show the row values from Form1's DataGridView
in Form2's DataGridView
?
I feel I am missing a step to add the actual values after inserting the columns, but I am stuck at this point.