?
Solved

Loop through files in multi-select dialog box

Posted on 2011-09-15
2
Medium Priority
?
327 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

765 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