Web browser and tab control (1 Viewer)

CedarTree

Registered User.
Local time
Today, 13:37
Joined
Mar 2, 2018
Messages
404
Hello,

I have a tab control. On Page 2, I have a web-browser that opens a PDF file. This works just fine. However, when I switch to Page 1 and then back to Page 2, the PDF (I think) is theoretically still in the web-browser but it just shows a blank web-browser. Any suggestions? Thanks.
 

CedarTree

Registered User.
Local time
Today, 13:37
Joined
Mar 2, 2018
Messages
404
One trick that I think will work (as a work-around) is to not place the web-browser on the tab control but make it visible = yes or no depending on which Page is clicked.
 

CedarTree

Registered User.
Local time
Today, 13:37
Joined
Mar 2, 2018
Messages
404
And... that didn't work. It seems when the web-browser window becomes invisible, either via code or if it's on a tab page and the page gets changed, the web-browser goes blank.
 

missinglinq

AWF VIP
Local time
Today, 13:37
Joined
Jun 20, 2003
Messages
6,423
At a minimum you probably need to post all the pertenent code...at best, sanitize (remove confidential data from a copy of the file) Compact, Zip and attach the file to a post.

Linq ;0)>
 

isladogs

MVP / VIP
Local time
Today, 18:37
Joined
Jan 14, 2017
Messages
18,211
OK I just did a test and replicated your result with a web browser on a tab control page. I didn't try your second test

However, if the web browser control is in a subform on the tab control page, the PDF isn't 'lost' when returning to the page

See attached - web browser in form frmStart.
Form frmTest has the tab control & frmStart as subform on Page 2

NOTE: Apply the attached registry fix if the PDF appears outside the application window

HTH
 

Attachments

  • SampleFileViewerTEST.zip
    45.7 KB · Views: 76

isladogs

MVP / VIP
Local time
Today, 18:37
Joined
Jan 14, 2017
Messages
18,211
Glad to have helped. I've no idea why it doesn't work without using a subform.

BTW you can also embed Word, Excel and PowerPoint docs within the web browser control.
The rather neat thing about doing that is that the external file is editable.
Particularly useful for Excel files where you also get the Excel toolbar
 

Users who are viewing this thread

Top Bottom