|
-
Jul 4th, 2017, 01:23 PM
#1
Thread Starter
Junior Member
[RESOLVED POORLY] Setting a PDF embedded inside a WebBrowser as the ActiveControl
Hi all,
I have a Windows Form with a TabControl, one of the tabs is named Tab_Help, and it contains a WebBrowser control which navigates to a PDF file that I generate.
My goal is to have the the PDF embedded inside the WebBrowser gain focus when the user selects the Help Tab. As it stands now, users need to click the PDF to begin scrolling through it, and I'd like to make it easier by shifting focus to the PDF the moment the Help tab is selected.
I set the WebBrowser to load the PDF on Form1 load, and aside from the fact that users need to click it before they can scroll through it, the PDF itself works perfectly.
vb.net Code:
Private Sub Form1.Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("C:\temp\pdftest.pdf#toolbar=0") ' Works perfectly
End Sub
Private Sub TabControl_SelectedIndexChanged() Handles TabControl.SelectedIndexChanged
If TabControl.SelectedIndex = TabControl.TabPages.IndexOf(Tab_Log) Then
ActiveControl = Textbox_Log ' This works perfectly, allows scrolling immediately
ElseIf TabControl.SelectedIndex = TabControl.TabPages.IndexOf(Tab_Help) Then
ActiveControl = WebBrowser1 ' Doesn't work
'WebBrowser1.Focus() ' Also doesn't work
'WebBrowser1.Document.Focus() ' Also doesn't work
End If
End Sub
Any suggestions?
Last edited by RichardG; Jul 5th, 2017 at 01:15 PM.
Reason: Kinda resolved, I guess
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|