I have a windows .net program that (among other things) will display image files. These can be in either TIFF or PDF format, and at the moment the way they are displayed is to see what the file extension is, then to call the appropriate program to display that file.
Here's the code fragment:
imagepath = imagedataset.Tables("Table").Rows(imagecal).Item(2)
imagepath = "\\tylerimaging\DocumentUpload\" & imagedataset.Tables("Table").Rows(imagecal).Item(3) & "\" & imagedataset.Tables("table").Rows(imagecal).Item(4)
Dim PDFImage As String = imagepath.Substring(imagepath.Length - 3)
If UCase(PDFImage) = "PDF" Then
System.Diagnostics.Process.Start("AcroRd32.exe", imagepath)
Else
Try
System.Diagnostics.Process.Start("MSPVIEW.EXE", imagepath)
Catch ex As Exception
If ex.Message = "The system cannot find the file specified" Then
System.Diagnostics.Process.Start("ois.exe", imagepath)
End If
End Try
End If
End If
Now, the problem is that if someone doesn't have the acrobat reader installed, for example, but the full version of adobe acrobat, the process.start for AcroRd32.exe will fail. But, Windows clearly has the association between the file type of PDF and Acrobat - so, here's my question - how can I get the file displayed by whatever program is associated with that file type in Windows?
Thanks in Advance....