3 Replies - 1950 Views - Last Post: 11 March 2013 - 08:24 AM Rate Topic: -----

#1 Leader2000  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-February 13

Message "Invalid index"

Posted 11 March 2013 - 07:10 AM

Hi!

I would like to make sort datas I want. But I have a problem I still receive this message "invalid index".
Then the yellow line stuck at this line:
crParameterFieldDefinition = crParameterFieldDefinitions["name"];


private void button1_Click(object sender, EventArgs e)
        {
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load("C\MyReport\CrystalReport1.rpt");

            ParameterFieldDefinitions crParameterFieldDefinitions ;
            ParameterFieldDefinition crParameterFieldDefinition ;
            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = txtBxName.Text;
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["name"];//here
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh(); 

        }
    }
}


Is This A Good Question/Topic? 0
  • +

Replies To: Message "Invalid index"

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9572
  • View blog
  • Posts: 36,244
  • Joined: 12-June 08

Re: Message "Invalid index"

Posted 11 March 2013 - 07:14 AM

Moving to C#.
Was This Post Helpful? 0
  • +
  • -

#3 Leader2000  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-February 13

Re: Message "Invalid index"

Posted 11 March 2013 - 07:25 AM

For example, in Crystal report I make this formula {name} = {?name}. When I try to save a message told me that "there is an error in your fomula. Do you want to save it anyway".
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3662
  • View blog
  • Posts: 11,466
  • Joined: 05-May 12

Re: Message "Invalid index"

Posted 11 March 2013 - 08:24 AM

This is a Crystal Reports issue rather than a C# issue.

Anyway, the invalid index exception tells you that there is no such field named "name" within the report.

I can't help you with regards to the formula. Perhaps somebody familiar with CR can help?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1