Export (0) Print
Expand All

Creating Your Own HTAs

Try It Yourself: Add a Multi-select List Box to an HTA


Shows how to add a multi-select list box to an HTA. This is the answer to a Try It Yourself exercise found in Part 2 of the introductory tutorial on creating HTAs.



<html>
<head>
<title>HTA Test</title>
<HTA:APPLICATION 
     ID="objTest" 
     APPLICATIONNAME="HTATest"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
>
</head>

<SCRIPT LANGUAGE="VBScript">

    Sub TestSub
        For Each objItem in MultiListbox.Options
            If objItem.Selected Then
                strSelected = strSelected & objItem.Value & vbCrLf
            End If
        Next
        Msgbox "You selected the following items: " & vbCrLf & strSelected
    End Sub  

</SCRIPT>

<body>

<select size="6" name="MultiListbox" multiple>
    <option value="atl-dc-01">atl-dc-01</option>
    <option value="atl-dc-02">atl-dc-02</option>
    <option value="atl-dc-03">atl-dc-03</option>
    <option value="atl-dc-04">atl-dc-04</option>
    <option value="atl-dc-05">atl-dc-05</option>
    <option value="atl-dc-06">atl-dc-06</option>
</select><p>

<input id=runbutton  type="button" value="Run" name="run_button"  onClick="TestSub">

</body>



Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft