简体   繁体   中英

Assign the VB6.0 Combo box value to Html drop down from vb 6.0 Code

I have an Html Form having dropdown controls over it. I want to select the combo box text from VB6.0 form and this combo box text is assign to html drop down, so how can i do this?.

my vb6.0 having the same controls that are on the html form.

for example my html code

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test Application</title>    
</head>
<body>

  Title : <select name="ddlTitle" id="ddlTitle" style="width: 70px;">
    <option value="Mr.">Mr.</option>
    <option value="Mrs.">Mrs.</option>
    <option value="Baba">Baba</option>
    <option value="Baby">Baby</option>
</select><br />
</body>
</html>

for vb6.0 i try this code i am getting an id of drop down but i want to assign the value to html dropdown box from vb6.0 combo box

    Dim HTMLI As HTMLInputElement

For Each HTMLI In TargetIE.Document.getElementsByTagName("select")
        Select Case HTMLI.id
            Case "ddlTitle"
            Dim i  As Integer
            For i = 0 To Combo1.ListCount
            If Combo1.ListIndex = HTMLI.Item(i).index Then
                HTMLI.Item(i).Value = Combo1.Text
                Exit For
            End If
            Next
        End Select
    Next HTMLI

while using this HTMLI.Value it give me an error Object doesn't support this property or method . so instead of value what I need to try.. so that vb6.0 combo value is assign to Html drop down

You'll want to use nodeValue instead of Value . So:

HTMLI.Item(i).Value = Combo1.Text

Should be:

HTMLI.Item(i).nodeValue = Combo1.Text

I solve this issue I use Selected instead of Value

HTMLI.Item(i).Selected = True
OR
HTMLI.Item(i).Selected = Combo1.Text

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM