Skip to Content

Problem AddRow in Matrix

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 08, 2012 at 04:51 PM

    Hi,

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

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 08, 2012 at 07:08 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.