Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21131

Filling out web form (Text boxes, Radio Button & Dropdowns) using VB6

$
0
0
So i have been searching for days. I have seen many posts on this topic but nothing that addresses my issue as a whole.

I have a form within vb6 that a user will fill out. When they press a command button I would like the data from that vb6 form to open a web page, and fill out the web form with the user provided data and submit.

The code I have now does in fact open the page and send data to text boxes but I am unable to figure out how to change the radio buttons and drop down boxes on the web form.

Here is what I have now: (which I found on another thread on VB Forums)
Code:

Dim WithEvents IE As InternetExplorer

Private Sub cmdSubmit_Click()
Set IE = New InternetExplorer
    IE.Visible = True
    IE.Navigate "http://www.somesiteform.com"
End Sub


Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If (pDisp Is IE.application) Then
        If URL = "http://www.somesiteform.com" Then
            Dim HTML As HTMLDocument
            Set HTML = IE.Document
            Dim INP As HTMLInputElement
            For Each INP In HTML.getElementsByTagName("input")
                If INP.Name = "site" Then 'replace q with the name of the field
                INP.Value = "" & text1.Text
                End If
                If INP.Name = "short" Then 'replace q with the name of the field
                INP.Value = "" & text2.Text
                End If
                If INP.Name = "det" Then 'replace q with the name of the field
                INP.Value = "" & text3.Text
                End If
                If INP.Name = "closet" Then 'replace q with the name of the field
                INP.Value = "" & text4.Text
                End If
                If INP.Name = "closed" Then 'replace q with the name of the field
                INP.Value = "" & text5.Text
        End If
        Next
    End If
End If
End Sub

I just cannot figure out how to select a radio button or a dropdown box iem using this code. Can anyone help me on this. Thanks :-)

Viewing all articles
Browse latest Browse all 21131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>