Results 1 to 8 of 8

Thread: WebBrowser.Navigate!

  1. #1

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Wink WebBrowser.Navigate!

    VB Code:
    1. frmWebBrowser.WebBrowser1.Navigate "http://www.someurl.com"
    The above code works perfectly when it is put in the Click event function of a menu item but the same code generates an error saying Method 'Navigate' of object 'IWebBrowser2' failed when it is put in the Click event function of a CommandButton. Why?

    Also where from is this IWebBrowser2 coming?

    Note that using Navigate2 instead of Navigate also generates the same error when the code is put in the Click event function of a CommandButton.

    Thanks,

    Arpan


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: WebBrowser.Navigate!

    ?? thats strange.. it works fine for me..

    I added 2 forms.. put the webbrowser in form 2 and a command button in form 1

    VB Code:
    1. Private Sub Command1_Click()
    2. Form2.Show
    3. Form2.WebBrowser1.Navigate "http://www.vbforums.com"
    4. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: WebBrowser.Navigate!

    I agree with Static... I did the same thing and it worked fine...

    Are you sure there isn't any code terminating reference to the Browser object?
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

  4. #4

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: WebBrowser.Navigate!

    ?? thats strange.. it works fine for me.
    I guess I was missing the frmWebBrowser.Show line but ain't sure since after adding that line, the error cited in post #1 was not generated though it paved the way for another error.

    Actually this is how I am trying to make the WebBrowser work. Navigate to the Tools--->Internet Options menu in IE & select the Content tab. When you click the Settings button under the heading Content Advisor, you will be asked to enter a password assuming that Content Advisor is enabled. After entering the correct password, the next dialog box that comes up has 4 tabs. Select the General tab & right at the bottom under the heading Rating systems, there is a Find Rating Systems button. When this button is clicked, the user is taken to a Microsoft URL which gets loaded either in an already open IE window or a new IE window if no IE windows are open.

    This is exactly what I am trying to do. I want to direct users to the Microsoft URL by opening a new instance of the browser that I have made but after adding the frmWebBrowser.Show line just before the Navigate line, I get the Can't show non-modal form when modal form is displayed error. How do I resolve this?

    Thanks,

    Arpan


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  5. #5
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: WebBrowser.Navigate!

    Check to make sure that the modal property used to show the form is not set...

    In other words just have Form1.Show and not Form1.Show 1
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

  6. #6
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: WebBrowser.Navigate!

    If the calling Form is meant to be Modal, then simply Unload or Hide it before calling the WebBrowser from.

    VB Code:
    1. Private Sub Command1_Click()
    2.    Unload Me 'or Me.Hide
    3.    Form2.Show
    4.    Form2.WebBrowser1.Navigate "http://www.vbforums.com"
    5. End Sub

  7. #7

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: WebBrowser.Navigate!

    Check to make sure that the modal property used to show the form is not set...In other words just have Form1.Show and not Form1.Show 1
    But I need that Form to be modal; that's unavoidable.
    If the calling Form is meant to be Modal, then simply Unload or Hide it before calling the WebBrowser from.
    If you follow the route I have shown in post #4 (IE), you will find that 2 modal Forms have to be opened to access the Find Rating Systems button in the Content Advisor dialog box. Adopting your approach would mean that even though a user is working with the Form which houses the Find Rating Systems button & might need to work with the other modal Form as well, I will force him to close that Form as well as the other modal Form & this is what I did like to avoid.

    Actually the best option would be to open the URL in a new browser window (not in an IE new window but in my browser window). The question is how? Any ideas how do I go about it?

    Thanks,

    Arpan
    Last edited by arpan_de; Dec 20th, 2005 at 02:01 PM.


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  8. #8
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: WebBrowser.Navigate!

    Well what you can do is disable the form and have it re-enabled once the other form closes....
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width