-
Mar 27th, 2014, 08:25 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Click a Website Button using VB 6
Hi,
I have a textbox named txtSrch, command button named cmdSrch and a Web Browser Control named wb1 navigated google.com on form load event.
I want that when i put phrase in txtSrch and click cmdSrch button,
it should show in the search textbox of google and automatically click on Google's Search Button.
AIM .....
1. To show anything written in the VB Text box on the Loaded Web Page.
2. Click Web Button using VB
Farooq
-
Mar 27th, 2014, 10:12 AM
#2
Re: Click a Website Button using VB 6
Why automate clicking the Google Search button when you can just send your search query directly to Google?
Code:
Private Sub cmdSrch_Click()
wb1.Navigate "http://www.google.com/search?q=" & Replace(txtSrch.Text, " ", "+")
End Sub
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Mar 27th, 2014, 10:18 AM
#3
Re: Click a Website Button using VB 6
See Google Terms of Service
Don’t misuse our Services. For example, don’t interfere with our Services or try to access them using a method other than the interface and the instructions that we provide. You may use our Services only as permitted by law, including applicable export and re-export control laws and regulations. We may suspend or stop providing our Services to you if you do not comply with our terms or policies or if we are investigating suspected misconduct.
What you describe violates these terms of service, which require access by users strictly through a web browser and not another program.
Doing this can get your entire subnet banned by Google.
This thread is venturing into prohibited topics.
Google offers an API for search that applies to some scenarios: Custom Search JSON/Atom API. This may have a charge associated with use depending on what you use it for.
Last edited by dilettante; Mar 27th, 2014 at 10:22 AM.
-
Mar 27th, 2014, 10:36 AM
#4
Thread Starter
Fanatic Member
Re: Click a Website Button using VB 6
Using google is only for example.
Want to know how to click the web button using vb6
-
Mar 27th, 2014, 11:53 AM
#5
Re: Click a Website Button using VB 6
If Google is only an example then is Google's Search Button also only an example? If so, then how can we know exactly what button you want to click on if, let's say, you are not using Google as the target Website.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
-
Mar 27th, 2014, 12:04 PM
#6
Re: Click a Website Button using VB 6
-
Mar 27th, 2014, 02:32 PM
#7
Thread Starter
Fanatic Member
Re: Click a Website Button using VB 6
I got a code from a site
Code:
For I = 0 To Wb1.Document.Forms(0).length - 1
If Wb1.Document.Forms(0)(I).Type = "submit" Then
Wb1.Document.Forms(0)(I).Click
Exit For
End If
Next I
Thanks for help.
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
|