私がする必要があること: 1. ユーザーが datagriview の行をクリックしたとき。この行のみが別のデータグリッドビューに表示されます(編集できるようにするためなど...)
注: grid_display = 行を取得する必要がある場所から。注: grid_detail = 単一の行をコピーする必要がある場所へ。
私が今まで持っているもの:
foreach (DataGridViewColumn c in grid_display.Columns)
{
grid_detail.Columns.Add(c.Clone() as DataGridViewColumn);
}
//then you can copy the rows values one by one (working on the selectedrows collection)
foreach (DataGridViewRow r in grid_display.SelectedRows)
{
int index = grid_detail.Rows.Add(r.Clone() as DataGridViewRow);
foreach (DataGridViewCell o in r.Cells)
{
grid_detail.Rows[index].Cells[o.ColumnIndex].Value = o.Value;
}
}
}
新しい行を作成することしかできません。ただし、選択した行をフィードしないでください。助けはありますか?