EFileTahi-A Posted April 26, 2006 Posted April 26, 2006 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. Quote
Administrators PlausiblyDamp Posted April 26, 2006 Administrators Posted April 26, 2006 Can't you just load a report with code like ReportDocument rpt = new ReportDocument(); rpt.Load(@" Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
EFileTahi-A Posted April 26, 2006 Author Posted April 26, 2006 (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 April 26, 2006 by EFileTahi-A Quote
Administrators PlausiblyDamp Posted April 26, 2006 Administrators Posted April 26, 2006 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
EFileTahi-A Posted May 3, 2006 Author Posted May 3, 2006 (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 May 3, 2006 by EFileTahi-A Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.