Solved

Loop through files in multi-select dialog box

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Welcome to part one of a multi-part tutorial series, VBScript for Windows System Administrators.  The goal of this series is to teach non-programmers how to write useful VBS code to automate their environment, and perform tasks faster, and in a more…
This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

11 Experts available now in Live!

Get 1:1 Help Now