Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Loop through files in multi-select dialog box

Posted on 2011-09-15
2
Medium Priority
?
335 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

810 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