PDF viewer VB.NET 2010 tutorial - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

PDF viewer VB.NET 2010 tutorial

PDF viewer for VB.NET 2010 tutorial shows how to view PDF file from your application using PDF Viewer SDK for Visual Basic .NET. It installs a control that you may add from toolbox to the form in your application.
Drag and drop PDF Viewer control and then add the following handler to your application to open PDF file in PDF viewer control:

Form1.cs:


Imports System.Windows.Forms

Public Partial Class Form1
   Inherits Form

Public Sub New()
 InitializeComponent()
End Sub

   Private Sub tsbOpen_Click(ByVal sender As Object, ByVal e As EventArgs) Handles tsbOpen.Click

       Using openFileDialog As New OpenFileDialog()

           openFileDialog.Title = "Open PDF Document"
           openFileDialog.Filter = "PDF Files (*.pdf)|*.pdf|All Files|*.*"

           If openFileDialog.ShowDialog() = DialogResult.OK Then

               Me.Text = openFileDialog.FileName

               Cursor = Cursors.WaitCursor

               Try
                   pdfViewerControl1.InputFile = openFileDialog.FileName
               Catch exception As Exception
                   MessageBox.Show(exception.Message)
               Finally
                   Cursor = Cursors.[Default]
               End Try

           End If

       End Using

   End Sub

End Class
prev
next