Solved

Control Webbrowser with VB6

Posted on 2011-03-20
9
483 Views
Last Modified: 2012-05-11
I'm trying to use the advice from this post:

http://www.experts-exchange.com/Programming/Languages/Q_21776208.html

But I keep getting:

"Object doesn't support this property or method"

On the line of code that "Clicks"
0
Comment
Question by:hrolsons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 35178077
I'm not a premium member yet... So can't read the solution you provided with above links...

Per my understanding whatever value you get from name and other fields, you could pass those values with the URL and Query String.

like http://www.google.com/pagename.htm?name=valueFromTextBox

I think this would work.
0
 

Author Comment

by:hrolsons
ID: 35178105
When I click your link it's error
0
 
LVL 19

Expert Comment

by:Rikin Shah
ID: 35178376
That is just an example...

You just need to replace the variable name from "name" to your required variable and its value which you captured from VB. Here I have added "valueFromTextBox"

You need to dynamically pass the URL from code and read the values from querystring to show them on the web page you're showing.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 20

Accepted Solution

by:
darbid73 earned 500 total points
ID: 35178475
That code works fine.

Look at this part here

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If firstPage Then
        firstPage = False


        WebBrowser1.Document.All.Item("q").Value = "Idle_Mind"
        WebBrowser1.Document.All("btnG").Click
    End If
End Sub

Open in new window


This is an event that happens when the document - ie the HTML document is downloaded from google and in your webbrowser.  Maybe this is not really finished.

To test this put something like this in there after the firstpage = False

msgbox "Just to pause things"

Then run and when you see the message wait a second and then click ok to let the code continue.

There is another was of doing this with the READYSTATE property of the webbrowser which is what we might also use if this is your problem.

0
 

Author Comment

by:hrolsons
ID: 35181621
darbid73:  Tried that and got the same thing.

rikin shah:  I know see that your code was just an example, silly me.
0
 
LVL 20

Expert Comment

by:darbid73
ID: 35182222
then you need to show your full code.
0
 

Author Comment

by:hrolsons
ID: 35182446
I have a blank form with 1 webbrowser control called webbrowser1:

Option Explicit

Private firstPage As Boolean

Private Sub Form_Load()
    firstPage = True
    WebBrowser1.Navigate2 "www.google.com"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If firstPage Then
        firstPage = False
        MsgBox "Just to pause things"
        WebBrowser1.Document.All.Item("q").Value = "Idle_Mind"
        WebBrowser1.Document.All("btnG").Click
    End If
End Sub
0
 
LVL 20

Expert Comment

by:darbid73
ID: 35182497
There is nothing wrong with the code.

does the webbrowser actually go to google.com?

Sometimes google goes to local sites instead.

If yes open the page with the navigate in the webbrowser control.  Then you get your error.  Then right click on it and view source.  Then save the source as a txt file and upload it.
0
 

Author Comment

by:hrolsons
ID: 35182700
I turned off "Instant Search" and it is working now.  Thank you for helping me work through that.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month3 days, 21 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question