2

Our system is progressing so far so good then I (the programmer) hit a wall again. I tried to convert all the ordinances into .pdf files; here's what I code:

Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
    e.Link.Visited = True

    Dim data1 As String = CType(e.Link.LinkData, String)

    Process.Start(data1)
End Sub

Private Sub FullText_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    LinkLabel1.Links.Add(13, 13, "C:\Users\Bagiuz\Desktop\CAPSTONE\Data\PDF\City Ordinance No. 2010-215.pdf")
End Sub

( The code above is my first try, it work but it will open pdf reader if I click the link label; it's okay but what I want is to open the pdf file inside the vb.net not just linking it to a pdf reader)


The next step I did was watch a video abour=t merging pdf into vb.net and I didn't really understand it cause the user (in the video) use a "SaveFileDialog" and inserted a "Image Viewer CP Gold ActiveX Control" this thing can be found in the COM Components after right clicking the SaveFileDialog Control. So as I was saying I tried it and it work but nothing happens, I conclude that it didn't display because he use SaveFileDialog.


The last step I did was using a "OpenFileDialog"

Dim OpenFileDialog As New OpenFileDialog

OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
OpenFileDialog.Filter = "PDF Files (*.pdf) |*.pdf|All Files (*.*)|*.*"

If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
Dim FileName As String = OpenFileDialog.FileName
Process.Start(OpenFileToolStripMenuItem.Text)
End If

it work but I can't open the file.


Im getting confused on what should I do, Can someone please help me with this? I'll gladly appreciate it :) Someone suggested that I should check out .net pdf viewers but I don't get it Language used: Vb.Net 2013

jmcilhinney
  • 50,448
  • 5
  • 26
  • 46
Xiamtsuntsun
  • 21
  • 1
  • 1
  • 2
  • If you want to display a PDF file within your application then you have to start with a control that can display a PDF file. An ActiveX control that has "Image Viewer" in the name sounds like it is for viewing images, not PDF files. Can you confirm that it actually does display PDFs? If it doesn't then you'll have to either include a PDF component with your app or else insist that the user have something like Adobe Reader installed and use that ActiveX control. – jmcilhinney Sep 05 '16 at 06:28
  • Apart from that, given that you have the path of the file you want to open in a variable named `FileName` and you want to open the file in an internal control, how can `Process.Start(OpenFileToolStripMenuItem.Text)` possibly do anything useful? You already know that `Process.Start` executes a file externally and `OpenFileToolStripMenuItem.Text` in no way refers to the file you want to open. – jmcilhinney Sep 05 '16 at 06:30

0 Answers0