Hi, I have a COM Pdf Viewer in my application that if I hard code a file location, will display the appropriate .Pdf.
My concern is how can I display the .Pdf based upon the current record in the gridView?
I am able to discern which record I am on within the gridView (therefore I have the ServerLocation and FileName) but am unable to put it all together to display the appropriate .Pdf.
The file path (file resides on another server) is stored in the DB as well as the filename (minus extension). Each directory
(approx. 20) has multiple subdirectories
(approx. 250) and the file can reside in either one of the directories.
The DB contains two fields: FileName, sLabel (server path).
I need to be able to loop through each subdirectory until it finds the FileName (txtFName) and if it is a ".Pdf" (there is a Tiff file in the same location), display the .Pdf file.
My code is as follows:
Code:
Dim p_sDir As String 'Physical file location ex. W:\imageLocation1
Dim txtFName As String 'FileName
p_sDir = "W:\" & grdDocs.CurrentRow.DataBoundItem("sLabel")
txtFName = grdDocs.CurrentRow.DataBoundItem("FileName")
Dim p_CurDir As New IO.DirectoryInfo(p_sDir)For Each p_Dir As IO.DirectoryInfo In p_CurDir.GetDirectoriesIf p_Dir.Extension.ToLower = ".Pdf" Then
AdobeReader.src = p_sDir & txtFName
End If
Next
This code loops but does return anything and I haven't been able to find the answer. Any help with this is tremendously appreciated!