0

I have datagridview in my WinForm application. This datagridview is getting filled with measurement results dinamically. On the third column program shows a value that is calculated only once for every 5 rows. So i want to merge empty cells of these 5 rows and show calculated value in one cell as a element of 5 rows. Please see screenshot. datagridview

I have checked the posts about merging cells on here and other several sites, but they are based on merging cells with same value. This is not my case.

How to Merge DataGridView Cell in Winforms

This is how i add values to datagridview;

if (cnt == 0 || cnt == 5)
{
taper = calcTap(tap1, tap2);
int index = daGridMeas.Rows.Add();
daGridMeas.Rows[index].Cells[0].Value = a[0].ToString();
daGridMeas.Rows[index].Cells[1].Value = a[1].ToString();
daGridMeas.Rows[index].Cells[2].Value = taper.ToString("0.0000");

taper.ToString("0.0000"));

cnt = 1;
}

else
{                 
int index = daGridMeas.Rows.Add();
daGridMeas.Rows[index].Cells[0].Value = a[0].ToString();
daGridMeas.Rows[index].Cells[1].Value = a[1].ToString();
daGridMeas.Rows[index].Cells[2].Value = "";

cnt++;
}
if (cnt == 1)
{
tap1 = float.Parse(a[1]);
}

How can i merge this cells together and fill it with calculated taper value?

Teo Laferla
  • 41
  • 1
  • 7
  • You can't. All you can do is remove some cell borders. Or overlay stuff. But any sort of actual merging is not supported. – TaW Sep 10 '19 at 11:37
  • How can remove these specific cells' borders? – Teo Laferla Sep 10 '19 at 11:46
  • See [here](https://stackoverflow.com/questions/52484960/hide-specified-cell-borders-in-datagridview/52487741?r=SearchResults&s=1|105.5640#52487741) ! – TaW Sep 10 '19 at 11:48

0 Answers0