Page 1 of 1

IndexOf Or Contains

Posted: Wed Dec 07, 2016 6:59 pm
by Leandro Borges
Hello.

I created a report that has 3 pages. I also created a variable called pTipoRel to control which page to print. In this variable the values "A, L, N" or "A, N" or "A, L" or "A" or "L" or "N" can be passed. I tried using Contains and IndexOf to control page printing but only worked when I passed the value "A, L, N" in the pTipoRel variable. When the other values are passed, this error returns: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index.

In the event before print of each page I put the following command:

Before print Page 1
if (pTipoRel.Contains("A")) {Page1.Enabled = true;} else {Page1.Enabled = false;}

Before print Page 2
if (pTipoRel.Contains("L")) {Page2.Enabled = true;} else {Page2.Enabled = false;}

Before print Page 3
if (pTipoRel.Contains("N")) {Page3.Enabled = true;} else {Page3.Enabled = false;}

Thank you.

Re: IndexOf Or Contains

Posted: Wed Dec 07, 2016 8:02 pm
by Leandro Borges
Hello.

I've solved the problem.

Thank you.

Re: IndexOf Or Contains

Posted: Thu Dec 08, 2016 4:35 am
by Andrew
Dear Leandro,

Ok. Thank you for the letting us know aboyt this.