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