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
Joined: Sat Jan 22, 2011 12:27 am

How to empty a drop-down list?

Post by hackoo » Wed Mar 23, 2011 8:34 pm

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: 13909
Joined: Tue May 22, 2007 9:57 am
Contact:

How to empty a drop-down list?

Post by jvierra » Thu Mar 24, 2011 1:48 am

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