cancel
Showing results for 
Search instead for 
Did you mean: 

Problem AddRow in Matrix

Former Member
0 Kudos

Execute the following code to add rows in a matrix.


for (int RecIndex = 0; RecIndex <= RecCount - 1; RecIndex++)
                    {
                        oMatrix.AddRow(1, oMatrix.RowCount);
                        string coluna = rec.Fields.Item(0).Value.ToString();
                        string descricao = rec.Fields.Item(1).Value.ToString();
                        ((SAPbouiCOM.EditText)oMatrix.Columns.Item("V_0").Cells.Item(oMatrix.RowCount).Specific).Value = coluna;
                        ((SAPbouiCOM.EditText)oMatrix.Columns.Item("V_1").Cells.Item(oMatrix.RowCount).Specific).Value = descricao;
                        rec.MoveNext();
                    }

The problem is that the values ​​are added to the matrix problems. Sometimes it adds value in a row, and sometimes the line with preeche blank.

In other words, is created in the amount of matrix rows according to the For, but many line are not satisfied with the values ​​passed.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member201110
Active Contributor
0 Kudos

Hi Harley,

What type of datasource is your matrix bound to (ie DBDataSource, UserDataSource or DataTable)? It's normally better to write your data to the datasource rather than the matrix cells (the only exception being system forms).

Kind Regards,

Owen

Former Member
0 Kudos

Hi,

You have not used RecIndex in your loop. I believe RecCount is a fixed value. That will not going to work.

Thanks,

Gordon