Solved

Loop through files in multi-select dialog box

Posted on 2011-09-15
2
321 Views
Last Modified: 2012-05-12
Hello,
I'm trying to automate a process that imports a RDF file into a viewer and exports it as a PDF file.

I've been partially sucessful in automating the process.
 
I can load multiple RDF files, the program will export a report for each one selected but the report is always for the first file selected in the dialog box. The first document loaded is disposed of but the same document loads again.
I'm not moving to the next file selected in the dlgOpenFile.FileNames.

Is this possible? or, should I add a listbox to the form, import files and run the loop on that?
I'd appreciate any help or suggestions.
Thanks
'openFileDialog_FileOk - loads selected file into the viewer control
    Private Sub dlgOpenFile_FileOk(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles dlgOpenFile.FileOk
        '1) Create a loop in the program logic to load an RDF file or stream into a Document object.
        Me.dlgOpenFile.Multiselect = True
        Me.cboExportFormat1.SelectedValue = "Portable Document Format (PDF)"

        
        Dim file As String
        For Each file In dlgOpenFile.FileNames
            Me.arvMain.Document.Load(Me.dlgOpenFile.FileName)

            ' 2) Pass this Document into the PDFExport object's Export method.          
            Dim filePath As String = Me.PromptSaveFile("Portable Document Format", ".pdf")
            Dim pdf As ArExports.Pdf.PdfExport = CType(Me.exportComponent, ArExports.Pdf.PdfExport)
            pdf.Export(Me.arvMain.Document, filePath)

            '3) Dispose of the document and repeat the process.
            Me.arvMain.Document.Dispose()
            Me.arvMain.Document = Nothing

        Next (file)        

    End Sub 'dlgOpenFile_FileOk

Open in new window

0
Comment
Question by:stoneycurtis
2 Comments
 
LVL 17

Accepted Solution

by:
andrewssd3 earned 500 total points
ID: 36543908
Shouldn't your line 10 read:

            Me.arvMain.Document.Load(file)

Open in new window

0
 

Author Closing Comment

by:stoneycurtis
ID: 36544026
WOW! I've been looking at that for 2 hours. (but not really seeing it)
Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question