How to empty a drop-down list?

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
hackoo
Posts: 103
Last visit: Tue Apr 26, 2016 9:02 am

How to empty a drop-down list?

Post by hackoo »

Hi I have this HTA "Drop Down Menu From File" I wonder if there is any methods or a Trick to empty my drop-down list?

Code: Select all

Source For Drop Down Menu From File 
'--==--==[ VBScript Source ]==--==-- 
Sub Window_Onload 
    ForReading = 1 
    strNewFile = "Phrases.txt" 
    Set objFSO = CreateObject("Scripting.FileSystemObject") 
    Set objFile = objFSO.OpenTextFile _ 
        (strNewFile, ForReading) 
    Do Until objFile.AtEndOfStream 
        strLine = objFile.ReadLine 
        Set objOption = Document.createElement("OPTION") 
        objOption.Text = strLine 
        objOption.Value = strLine 
        AvailablePhrases.Add(objOption) 
    Loop 
    objFile.Close 
End Sub 
Sub onthefly 
    Selection = AvailablePhrases.Value 
MsgBox "You Selected:" & VBCRLF & Selection, 64,"On-The-Fly List Box" 
End Sub 'onthefly 
Sub OpenPhrases 
ShellRun = objShell.Run ("%comspec% /c Start Notepad Phrases.txt", 0, 1) 
End Sub 
--==--==[ HTML Source ]==--==-- 
Drop Down Menu From File
 
 
   
 
 
hackoo2011-03-24 03:37:38

jvierra
Posts: 14827
Last visit: Thu Jun 17, 2021 11:18 am
Answers: 10
Has voted: 3 times
Been upvoted: 10 times

How to empty a drop-down list?

Post by jvierra »

Code: Select all

For i = 0 To mylist.options.length
mylist.options.remove 0
Next
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Locked