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.
Loading

VulpesPosted Jun 2, 2012, 7:02 PM
MementoPosted Jun 3, 2012, 10:35 AM
VeryUsefulLargeProgrammingExcellentSupport :)
VulpesPosted Jun 3, 2012, 7:56 AM
MementoPosted Jun 3, 2012, 3:47 AM
One big mistake:
Your avatar is inCorrect. You must take an EinsteinLike image.
In fact... - Who are you?
What is your DataSource, i.e. from which CosmicPoint you receive all these perfectly and punctually correct codeLines ?
Is that some book, or Guru or...
I was searching for solutions - about ten days (msdn forum, stackoverflow, codeproject...) - you could go there and see what all was answered.
Your code works without changing any point, any comma, any letter.
My FarGoal is to make a rather large application for my company, based on sql. We already have some, but, for years, we are not satisfied. When finished the application would be ready to offer - on a commercial basis. May I write you on a private mail ?
MementoPosted Jun 2, 2012, 4:28 PM
Yes, regardless how many cell are selected, they should be copied sequentially till end of row.
For example selection is: a b c d
After a buttonClick the rest of row should be: a b c d a b c d a b c d ... till end of row.
If I select only a b - then a b a b a b ... till end - and so on for every rows (if selected cells belongs to multiple rows).
Or, maybe, there is a shorter way to have an excelLike dgv in c# project. The same company produced both.
VulpesPosted Jun 2, 2012, 1:45 PM
Also what happens if more than one cell is selected in the same row - do you copy up to the next selection and so on until the end of the line?