IndexOf Or Contains

Stimulsoft Reports.NET discussion
Post Reply
Leandro Borges
Posts: 219
Joined: Tue Oct 27, 2015 4:19 pm

IndexOf Or Contains

Post 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.
Leandro Borges
Posts: 219
Joined: Tue Oct 27, 2015 4:19 pm

Re: IndexOf Or Contains

Post by Leandro Borges »

Hello.

I've solved the problem.

Thank you.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: IndexOf Or Contains

Post by Andrew »

Dear Leandro,

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