Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

The point is to load all my crystal reports from a target directory when the program executes.

 

How will I do this? I know will need to use the a "stream" object but I can't figure it out.

Posted (edited)

Hi, PlausiblyDamp.

 

Yeah, that way works out, but not how I would like it to work. I want to load all available reports at once into some "storage" object (HashTable?) so that I can access them when needed, also because, there might be new reports on the target directory when I run the program, thus I can't access directly to a specific report because I don't know the name of the new report...

 

What I want to do is:

 

1 - The program loads all reports form a target dir.

2 - I add those reports to a combobox/listview or something. They are identified using their filename.

3 - I choose the report to use from the combobox/listView.

4 - I show for the report by searching it within the reports storage object based on their filename...

 

I guess I could load all of them to a Report[] array object, but how would I identify them?

 

I hate Crystal reports...

 

Let me know if this is confusing... :\

Edited by EFileTahi-A
  • Administrators
Posted

Could you not load them into a hashtable like you suggested? i.e. On load loop through all .rpt files, for each one found add it to the hashtable using the FileName as the Key and the ReportDocument as the data. (Or use a generic collection if running under .Net 2).

 

This way you could always refer to an entry in the list by it's filename anyway.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted (edited)

Well... I tryed the HashTable method but it does not work. I do loaded all reports into the hastable but they would be blank the minute I would tell CrystalReports to display them, and, I made sure the CrystalReport's sheets were loaded when I added them to the hashtable...

 

Anyway, I used a ReportDocument[] array and it worked just fine :). I used then an hashtable to memorize in which array element the report named x would be...

 

ReportDocument[] rptDocArr = new ReportDocument[20];
ReportDocument rptDoc = new ReportDocument();

iElement = hashtable[sReportName];
rptDoc = rptDocArr[iElement];

 

Anyway, thank you for your effort and time PlausiblyDamp. You did helped me with the "Report.Load" thingie which I was missing ;)

 

- THREAD CLOSED -

Edited by EFileTahi-A

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...