Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 486
  • Last Modified:

Control Webbrowser with VB6

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
hrolsons
Asked:
hrolsons
  • 4
  • 3
  • 2
1 Solution
 
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
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
 
hrolsonsAuthor Commented:
When I click your link it's error
0
 
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
darbid73Commented:
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
 
hrolsonsAuthor Commented:
darbid73:  Tried that and got the same thing.

rikin shah:  I know see that your code was just an example, silly me.
0
 
darbid73Commented:
then you need to show your full code.
0
 
hrolsonsAuthor Commented:
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
 
darbid73Commented:
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
 
hrolsonsAuthor Commented:
I turned off "Instant Search" and it is working now.  Thank you for helping me work through that.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now