I have a report that I allow the sorting order to be defined by the End User. Multiple choices can be selected for each sorted column (I allow 3 different sorts on same report). When I am receiving an error when running the report and can not find either the correct approach or a method to achieve the sorting I need. Here is a quick code sample (field name modified for readability, but same value):
crReport.DataDefinition.SortFields(0).Field = crReport.Database.Tables(My.Settings.EmployeeTable).Fields("")
crReport.DataDefinition.SortFields(0).SortDirection = SortDirection.AscendingOrder
crReport.DataDefinition.SortFields(1).Field = crReport.Database.Tables(My.Settings.EmployeeTable).Fields("")
crReport.DataDefinition.SortFields(1).SortDirection = SortDirection.AscendingOrder
Thrown exception:
"Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"
The exception is thrown on the first line.
I am using Crystal Reports 2008 with Visual Studio 2005.
Any help would be greatly appreciated.
Steve