Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2012 Preview PDF using Webbrowser

$
0
0
I am trying to use the Webbrowser control to preview my PDF files.

When I select the PDF file it only shows something like a place-marker, and not the PDF file.. ( A few days ago , it did work..:mad:)

Here is the code:

Code:

    Private Sub ListBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox2.SelectedIndexChanged
        Dim DirectoryPart2 As String = ListBox1.SelectedItem.ToString
        Dim DirectoryPart1 As String = "C:\QMS FORMS\"
        Dim DirectoryName = DirectoryPart1 & DirectoryPart2 & "\" & ListBox2.SelectedItem.ToString
        WebBrowser1.AllowNavigation = True
        WebBrowser1.Navigate(DirectoryName)
        Dim FileNameLen As Integer = Len(DirectoryName)
        FileNameLen = FileNameLen - 4
        If My.Computer.FileSystem.FileExists(DirectoryName.Substring(0, FileNameLen) & ".RTF") Then
            RichTextBox1.Rtf = FileIO.FileSystem.ReadAllText(DirectoryName.Substring(0, FileNameLen) & ".RTF")
        Else
            RichTextBox1.Text = "The file " & DirectoryName.Substring(0, FileNameLen) & ".RTF" & " ,does not exsist"
        End If
    End Sub

And here a some screen shot when I run the application. See the X in the top corner of the Webbrowser, that is all I am seeing

Name:  Image1.png
Views: 103
Size:  41.6 KB
Attached Images
  

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>