PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
[RESOLVED POORLY] Setting a PDF embedded inside a WebBrowser as the ActiveControl-VBForums
Results 1 to 6 of 6

Thread: [RESOLVED POORLY] Setting a PDF embedded inside a WebBrowser as the ActiveControl

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2012
    Posts
    25

    Resolved [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:
    1. Private Sub Form1.Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    2.     WebBrowser1.Navigate("C:\temp\pdftest.pdf#toolbar=0") ' Works perfectly
    3. End Sub
    4.  
    5. Private Sub TabControl_SelectedIndexChanged() Handles TabControl.SelectedIndexChanged
    6.     If TabControl.SelectedIndex = TabControl.TabPages.IndexOf(Tab_Log) Then
    7.         ActiveControl = Textbox_Log ' This works perfectly, allows scrolling immediately
    8.     ElseIf TabControl.SelectedIndex = TabControl.TabPages.IndexOf(Tab_Help) Then
    9.         ActiveControl = WebBrowser1 ' Doesn't work
    10.         'WebBrowser1.Focus() ' Also doesn't work
    11.         'WebBrowser1.Document.Focus() ' Also doesn't work
    12.     End If
    13. 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
  •  



Featured


Click Here to Expand Forum to Full Width