Solved

Loop through files in multi-select dialog box

Posted on 2011-09-15
2
319 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now