vb6mergemsflexgrid

MergeCol does not work while MergeRow does


I have a small MSFlexGrid with 1 fixed column, and 2 fixed rows.

enter image description here

As you can see MergeRow works in the top row.

I want the 2 top cells from the first column to merge as well, but the separation remains.

The code I am using is:

with grdPrm
  .MergeCells = 1
  .MergeRow(0) = True
  .MergeCol(0) = True
  .TextMatrix(1, 0) = .TextMatrix(0, 0)
End With 'grdPrm

I tried the values 0,1,2,3,4 for MergeCells as well as the constants flexMergeFree and flexMergeRestrictBoth.

Does anyone know why MergeCol does not work for me?


Solution

  • It appears that .TextMatrix(1, 0) = .TextMatrix(0, 0) does not make the contents exactly equal.

    MergeCol does work when I replace that line with:

    .TextMatrix(0, 0) = "    "
    .TextMatrix(1, 0) = "    "
    

    It probably has something to do that I originally filled TextMatrix(0,0) via the .FormatString property:

    .FormatString = "^    " & "|> " & strFC(0) & " |> " & strFC(0) & " " & ......
    

    Apparently .TextMatrix(1, 0) = .TextMatrix(0, 0) only assigns the contents, while MergeCol also checks for more than that (like explicit formatting)