Last thumbnail not displayed

Discussions about document viewing.
Post Reply
BenV
Posts: 21
Joined: Thu Dec 02, 2010 4:54 pm

Last thumbnail not displayed

Post by BenV » Fri Jun 03, 2011 3:01 pm

Hey

My thumbnail viewer won't display the last thumbnail, only the text.
Screenshot:
Image

The thumbnails are loaded with this method:

Code: Select all

Private Sub LoadAllPDFPages()
        Dim intIndex As String = 0
        Dim intSelectedIndex As String = 0
        Dim strFileNoPage As String = Me.PDFFile.Substring(Me.PDFFile.LastIndexOf(Path.DirectorySeparatorChar) + 1, Me.PDFFile.LastIndexOf("-") - Me.PDFFile.LastIndexOf(Path.DirectorySeparatorChar))
        Dim intPageNr As Integer = CInt(Me.PDFFile.Substring(Me.PDFFile.LastIndexOf("-") + 1, Me.PDFFile.LastIndexOf(".") - Me.PDFFile.LastIndexOf("-")))
        For Each strFile As String In My.Computer.FileSystem.GetFiles(My.Settings.OutputDirectory, FileIO.SearchOption.SearchTopLevelOnly, strFileNoPage & "*.pdf")
            Dim intCurPageNr As Integer = CInt(strFile.Substring(strFile.LastIndexOf("-") + 1, strFile.LastIndexOf(".") - strFile.LastIndexOf("-")))
            If intPageNr = intCurPageNr Then
                intSelectedIndex = intIndex
            End If
            PdfPagesThumbnailViewer.AddItemFromFile(strFile)
            PdfPagesThumbnailViewer.SetItemText(intIndex, strFileNoPage & CStr(intCurPageNr) & ".pdf")
            intIndex += 1
        Next
        PdfPagesThumbnailViewer.SelectItem(intSelectedIndex)
    End Sub
Each thumbnail is a sperate PDF file. This happens with every collection of pdf's I load into the the viewer. If the collection contains only two pages, also the last (second) page is not displayed.

Kind regards

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Last thumbnail not displayed

Post by Loïc » Fri Jun 03, 2011 4:03 pm

Hi Ben,

Are you using the latest version ?

I am not able to reproduce such issue.

Kind regards,

Loïc

BenV
Posts: 21
Joined: Thu Dec 02, 2010 4:54 pm

Re: Last thumbnail not displayed

Post by BenV » Mon Jun 06, 2011 5:11 pm

Hey

I always forget to mention the version. At that moment I was using 7.4.03, but I already downloaded revision 10. I can't say the problem is solved in the new release 'cause I get an other error:

Code: Select all

'i' is not accessible in this context because it is 'Friend'.
For every For-loop that uses 'i' or 'j' or whatever, I get this error. Not sure what it is, I've never seen it before. I think it's in my code, but the strange part is that the errors are raised as soon as I've added a reference to GdPicture 7.4.10. It still works with the older version though.

[EDIT]
By the way, the link to the gdpicture zip file seems to be dead. I had to download the exe instead.

BenV
Posts: 21
Joined: Thu Dec 02, 2010 4:54 pm

Re: Last thumbnail not displayed

Post by BenV » Wed Jun 08, 2011 10:04 am

Oke, I'm pretty sure it's in the GdPicture framework. I've created a new project, added the reference, and wrote this:

Code: Select all

Imports GdPicture
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For i = 0 To 10  '<-- Here

        Next
    End Sub
End Class
That's all and I get the same error:

Code: Select all

'i' is not accessible in this context because it is 'Friend'.
I hope you know a quick solution 'cause it's quite urgent.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Last thumbnail not displayed

Post by Loïc » Wed Jun 08, 2011 11:46 am

Hi,

Here the good syntax:

Code: Select all

For i as Integer = 0 To 10 
Hey, you should read a VB.NET tutorial ;)

Kind regards,

Loïc

BenV
Posts: 21
Joined: Thu Dec 02, 2010 4:54 pm

Re: Last thumbnail not displayed

Post by BenV » Wed Jun 08, 2011 12:20 pm

My god, I really didn't know that. :shock: I should know it! In almost every language you have to declare the type of the counter. How stupid and shameful. Isn't it something "option explicit" should catch? No excuse though...

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Last thumbnail not displayed

Post by Loïc » Wed Jun 08, 2011 12:26 pm

HAHA :mrgreen:

To don't go through this kind of problem I suggest to add in each of your vb sheets:

Code: Select all

Option Strict On
Option Explicit On
Option Compare Binary
Option Infer On
Also, despite of some permissive languages, I suggest to always declare all your variables before going through definition. This fix many problems and make your code more clear.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest