When would PDFView.GetVisiblePages() be out of order or not up to date?

For switching the current page in my program, I have some code like:

int[] pages = GetVisiblePages();
int ret = pages[0];

However, I’m running into a problem when I have a sticky note open where pageNum will be 2, but ret will still get set to 1 and visa-vera. Only after changing pageNum multiple times will ret=pageNum.

My thoughts were that maybe events were queuing up but the queue wasn’t fully emptying, but Application.DoEvents() doesn’t seem to help either.
Any thoughts would be great, even a suggestion of where to look.


Hello Tommy,

Thanks for letting us know that you’re seeing this. What other values are printed in the array returned by GetVisiblePages()? Note that SetCurrentPage() can sometimes leave a slight portion of the previous page visible (in a continuous page presentation mode).

Whatever page I open a sticky note on, that page seems to want to stay visible. Even after SetCurrentPage(), GetVisiblePages() is only returning the one page with the sticky note.
I am using a continuous page presentation mode, is there anything special I should make sure I’m doing in order to get the page to change? Also, since I’m not creating the sticky note programmatically, is there any way to get a reference to the sticky note from the page?

I have found the issue. I needed to call Control.Update() on my forms, and a need to use DocLock(true). It seems that the visible page and current pages were changing correctly, but something else was immediately changing them back to their old values; locking the document and terminating all other threads using it (passing true) fixed this issue.