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

vb6 talking to asp

Posted on 2006-06-14
Last Modified: 2010-04-30
I have an asp page where there is a text box which I put in a number, do some work, then spit back another number.
It is a really crude valitdation thing that works pretty well.

I would like to be able to call the page in the background from a vb application and have the software read the number from the web.

So instead of someone going to my page, putting a number in a box, hitting submit, then copying and pasting the number back to the application, I would like to do it in the background.

I am using vb6.

How would I do this?
Question by:jackjohnson44
  • 4
  • 3

Accepted Solution

donald9 earned 500 total points
ID: 16914728
Add this control to your project:
Microsoft Internet Controls

Drag the "WebBrowser" to your form.

Use this code to navigate to the page:

WebBrowser1.Navigate2 ("http://www.url.com/?i=" & variabletopass)

where variabletopass is the number you want to pass your ASP page.

Now, you need this subroutine

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    verinfo = WebBrowser1.Document.documentelement.innerHTML
    verinfo = Replace(lcase(verinfo), "<html>", "")
    verinfo = Replace(lcase(verinfo), "<body>", "")
    verinfo = Replace(lcase(verinfo), "</body>", "")
    verinfo = Replace(lcase(verinfo), "</html>", "")
    verinfo = Replace(lcase(verinfo), "</head>", "")
    verinfo = Replace(lcase(verinfo), "</body>", "")
    verinfo = Replace(lcase(verinfo), "<head>", "")
    verinfo = Replace(lcase(verinfo), "<body>", "")
    verinfo = Replace(lcase(verinfo), " ", "")
    verinfo = Replace(lcase(verinfo), Chr(10), "")
    verinfo = Replace(lcase(verinfo), Chr(13), "")
End Sub

Now, the "verinfo" variable will have just the number that was passed from your ASP page as long as the ASP page is ONLY wrighting out that number. If it is writing out more than just that number you want, either remove the other info, create another page, or use the replace code above to remove the extra info.

Also, be sure your ASP page is using request.querystring instead of request.form

Hope that helps. Let me know if you need more help / clarification.

Author Comment

ID: 16915415
is this .net?

Expert Comment

ID: 16915444
no. classic vb.
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.


Author Comment

ID: 16915483

Should "WebBrowser1.Navigate2" and "WebBrowser1_NavigateComplete2" be the same?

WebBrowser1.Navigate2 ("http://www.url.com/?i=" & variabletopass)

Private Sub WebBrowser1_NavigateComplete2

Expert Comment

ID: 16915505
no. they are different. The first is calling a function of the WebBrowser control. The second is creating a subroutine.

Author Comment

ID: 16915552
so what calls the sub?

Expert Comment

ID: 16915744
when you call the navigation function and tell it to go to a web page the control automatically passes back information to your application and that sub routine is called without you having to do anything once the web page has finished loading.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

861 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