We help IT Professionals succeed at work.

Convert simple asp form to a vb6 form

Jimmyx1000
Jimmyx1000 asked
on
Medium Priority
271 Views
Last Modified: 2010-05-01
Id like to use an exe to send data to an asp page

how can i convert the following to vb6

<form method="POST" action="recieve.asp">
Name <input type="text" name="Name"/>
Age <input type="text" name="Age"/>
<input type="submit" />
</form>


thanks experts
Comment
Watch Question

Commented:
I believe you can use the Internet Transfer Control component.

Then you can just form the URL as "http:/xxxxxxx.com/receive.asp?name=xxxx" etc and call the inet.OpenURL and passing the URL string.

Author

Commented:
can you give the full vb6 code please


thankyou experts
Commented:
Maybe something like the below.

I haven't actually tested it (no server-side script) but it should work. It may require slight modifications if not. Also, you may need to "escape" the characters for pData (such as changing " " into %20 (hex for a space).

Form1:
---------------------
Option Explicit
Private Sub Form_Load()
    '
End Sub
Private Sub Command1_Click()
    Call FormSubmit("http://www.google.com/response.asp", "the_name", "the_age")
End Sub
Private Sub FormSubmit(ByVal sPath As String, ByVal sName As String, ByVal sAge As String)
    Dim pHdr As String
    Dim pData As String
    pHdr = "Content-Type: application/x-www-form-urlencoded" & vbCrLf & vbCrLf
    pData = "Name=" & sName & "&Age=" & sAge
    If (Inet1.StillExecuting = True) Then
        Inet1.Cancel
    End If
    Call Inet1.Execute(sPath, "POST", pData, pHdr)
End Sub

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Commented:
Check out the code that zzzzooc has given. He has provided what I meant...

Commented:
>>He has provided what I meant
What did you mean?

Author

Commented:
can you please test this , to see if it works

thankyou experts

Author

Commented:
seems to be an error

compile error ,
variable not defined

on line
If (Inet1.StillExecuting = True) Then

which controls do i need to add also

thanks experts

Commented:
1. Go to Project | Component
2. Look for Internet Transfer Control component.
3. Add it into your project.
4. Pick the component from the toolbox and add to your form.

Author

Commented:
How can i get some sort of response returned when the command button is clicked
i.e post info recieved ok

here is my asp recieve page


<%
Dim name, age
name = Request.Form("Name")
age = Request.Form("Age")
Response.Write("Name: " & name & "<br />")
Response.Write("Age: " & age & "<br />")
%>
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.