ComponentOne VSView 8.0
Step 2: Opening Files

Double-click on the Open button, and add the following code to the cmdOpen_Click event handler:

Example Title
Copy Code
Private Sub cmdOpen_Click()

 

  ' get file to open

  dlg.FileName = FileName

  dlg.ShowOpen

  If dlg.FileName = "" Then Exit Sub

  FileName = dlg.FileName

 

  ' do it

  RenderFile

 

End Sub

The routine is simple: it uses the CommonDialog control dlg to present a file selection dialog to the user, then saves the selected file name in a global variable called FileName, and defers the real work to the RenderFile routine, which still needs to be written.

Before getting into the RenderFile routine, go to the declarations part of the form and declare the global variable FileName. The declarations section of the form should look like this:

Example Title
Copy Code
Option Explicit Option Compare Text ' keep track of file being previewed Dim
    FileName$

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback