[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

vb6 talking to asp

Posted on 2006-06-14
7
Medium Priority
?
306 Views
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?
0
Comment
Question by:jackjohnson44
  • 4
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
donald9 earned 2000 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.
0
 

Author Comment

by:jackjohnson44
ID: 16915415
is this .net?
0
 
LVL 1

Expert Comment

by:donald9
ID: 16915444
no. classic vb.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:jackjohnson44
ID: 16915483
Thanks

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

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

Private Sub WebBrowser1_NavigateComplete2
0
 
LVL 1

Expert Comment

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

Author Comment

by:jackjohnson44
ID: 16915552
so what calls the sub?
0
 
LVL 1

Expert Comment

by:donald9
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.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

873 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