6
Answers

c# winforms DataGridView - how to repeat content of selected cell or cells ?

Memento

Memento

12y
2.6k
1
How can I copy (repeat) selectedCellsValue - till end of row.
Number of cells (i.e. Columns) in a row - varies (about 30).
Excel have that option named - autoFill - Copy.
Here is my try:
int x = dgv.SelectedCells.Count;
  foreach (DataGridViewCell c in dgv.CurrentRow.Cells)
   {
   if (c.Selected == true)
   {
   string a = c.Value.ToString();
  x = x+1;
  dgv.CurrentRow.Cells[x].Value = a;
  But it copies selectedeCells only once.
Answers (6)