|
-
Dec 20th, 2005, 10:06 AM
#1
Thread Starter
Frenzied Member
WebBrowser.Navigate!
VB Code:
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?
-
Dec 20th, 2005, 10:10 AM
#2
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:
Private Sub Command1_Click()
Form2.Show
Form2.WebBrowser1.Navigate "http://www.vbforums.com"
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Dec 20th, 2005, 10:30 AM
#3
Hyperactive Member
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.
-
Dec 20th, 2005, 11:27 AM
#4
Thread Starter
Frenzied Member
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?
-
Dec 20th, 2005, 11:31 AM
#5
Hyperactive Member
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.
-
Dec 20th, 2005, 11:40 AM
#6
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:
Private Sub Command1_Click()
Unload Me 'or Me.Hide
Form2.Show
Form2.WebBrowser1.Navigate "http://www.vbforums.com"
End Sub
-
Dec 20th, 2005, 01:58 PM
#7
Thread Starter
Frenzied Member
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?
-
Dec 20th, 2005, 07:04 PM
#8
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|