Solved

Triggering 'Submit' on a Web Page

Posted on 2000-05-11
6
224 Views
Last Modified: 2010-05-02
I am interested in knowing how to fill a text box on a target web page and invoking that page's "submit" button using VB 5.0.  I believe that I have been able to Post the text to the page, but I haven't been able to trigger the 'Submit' button.  It might be helpful to note that the 'Submit' button is the default button on the page.  
0
Comment
Question by:aarik
6 Comments
 
LVL 14

Accepted Solution

by:
mcrider earned 400 total points
ID: 2803074
Add a WebBrowser control to your program and then do this:

   WebBrowser1.Navigate "http://www.yourdomain.com/cgi-bin/your.cgi?Arg1=aaa&Arg2=bbb

Everything after the "?" is sent to the server as if a GET was performed.  Multiple arguments are separated by "&".

To add the WebBrowser control to your project, right-click on the toolbar and select "Components..." then select "Microsoft Internet Controls" from the list...

By the way, if you don't want the user to see the resulting web page that is returned, set the Visible property of the WebBrowser control to FALSE.


Cheers!®©


0
 
LVL 14

Expert Comment

by:mcrider
ID: 2803083
Also... your "submit" button is going to pass an argument in the URL, so for example:

   WebBrowser1.Navigate "http://www.yourdomain.com/cgi-bin/your.cgi?Arg1=aaa&Arg2=bbb&Submit=1"


Get the idea??


Cheers!®©



0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2803093
if hes already got focus on the page and set the text (as he said) then cant he just use sendkeys??

SendKeys "{TAB i}"  'where i is the number of times you need to tab
SendKeys Chr(32)
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 1

Expert Comment

by:jannea
ID: 2803459
I guess you can use:

Private Declare Function ShellExecute Lib "shell32.dll" Alias _
  "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
  ByVal lpFile As String, ByVal lpParameters As String, _
  ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


      ShellExecute Me.hwnd, vbNullString, _
      ("http://www.yourdomain.com/cgi-bin/your.cgi?Arg1=aaa&Arg2=bbb&Submit=1", vbNullString, "C:\", 1
0
 

Author Comment

by:aarik
ID: 2804663
Thank you for your prompt response!
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2807710
Thanks for the points! Glad I could help!


Cheers!®©
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 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