Adding to your Visual Basic Project
Back to Help Home

To
add Print Preview to your Visual Basic project
-
On
the Project menu, click References
to display the References dialog box.
-
To
add the Print Preview control to the toolbox, click the Browse
button, and locate the file
preview.dll, this is normally installed into C:\Program
Files\Preview but depends on the options you selected
during installation.
-
When
you add the Print Preview ActiveX DLL to the list of available
ActiveX, Visual Basic automatically selects its check box in the
Components dialog box.
To
add Print Preview to your code
You
need to define a variable using the WithEvents keyword in the
general, declarations section of a form. You then need to create an
instance of the control and you can then make reference to it. The
example below can be pasted straight into an empty form.
Option
Explicit
'
*** Declare the variable so that it can
receive events
Public
WithEvents pvwMain As
PrintPreview5.Preview
Private Sub Form_Load()
' *** Create an instance of the control
Set pvwMain = New
PrintPreview5.Preview
' *** Display the Print Preview About dialog
pvwMain.About
End
Sub
Back to Help Home |