Showing results for 
Search instead for 
Did you mean: 

Message: Row - Invalid index

Former Member
0 Kudos


I have a big problem. I created simple form (only one matrix with three columns) with screenpainter. I added datasources to this form, bind data for this form. I used my function for get data from datasource.

Here is code of function.

private void getDataFromDataSourceCiselnikUrovni(SAPbouiCOM.Form oForm,
      SAPbouiCOM.Matrix oMatrix, string tableName, string tableMatrix) {
      SAPbouiCOM.DBDataSource oDBDataSource =
        oForm.DataSources.DBDataSources.Item("@" + tableName);
      SAPbouiCOM.UserDataSource oUserDataSource =
      for (int i = 0; i < oDBDataSource.Size; i++) {				
        //oUserDataSource.Value = "nejaka hodnota";
        oDBDataSource.Offset = i;
        oUserDataSource.Value = ((int)(i + 1)).ToString();
        oMatrix.AddRow(1, -1);
      SAPbouiCOM.EditText oEditText =
      if (oEditText.Value != ""){
      	switch (oForm.Type){
      		case 2000060302:{ //-- Ciselnik urovni
      			setUpNewRowCiselnikUrovni(oForm, oMatrix, oForm.DataSources.UserDataSources,oDBDataSource);

When i want open form the system write message: Row - invalid index. I dont know what does it means. I used the same function at SAP B1 6.5 and everything is OK.

Thanks for your answer?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Alexey, you are right, I didn't read well, sorry...!

Does the AddRow method accepts '-1' as position parameter? That looks a invalid row to me... (I could be wrong)

My code, for something simular:

<b>Code (C#):</b>

oMatrix.AddRow(oDBDataSource.Size, 0);
for(int i = 1; i <= oDBDataSource.Size; i++)
  oUserDataSource.Value = i.ToString();
  oDBDataSource.Offset = i - 1;

Hope it helps!

Active Contributor
0 Kudos

I suppose that error is in setUpNewRowCiselnikUrovni().

There are no any critical lines in your code exept that method. Step in it. Could you publish its content?

Former Member
0 Kudos

-- Stupid answer --

Message was edited by: R. Schwachofer

Active Contributor
0 Kudos


for (int i = 0; i < oDBDataSource.Size - 1; i++) {

Active Contributor
0 Kudos


what line exactly raise an error while you debuggin'?

by the way, your for-loop is ok.