Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


How do i remove an item from HTA list box?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61757
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How do i remove an item from HTA list box?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 How do i remove an item from HTA list box? - 6/23/2008 9:23:59 PM   
  struttshumming

 

Posts: 8
Score: 0
Joined: 3/14/2008
Status: offline
Hi there,

I am kind of new to HTA and looking to dynamically populate a list box and have two control buttons.

One control butoon will add a selected item to another emty list box, but i cant seem to work out the method needed to remove a selected item from the second list box.

Here is my code so far, can any kind soul show me what method i need?

Thanks,

SH

<html>
<head>
<title>Server Task Scheduler</title>
<HTA:APPLICATION
APPLICATIONNAME="Create Task"
SCROLL="yes"
SINGLEINSTANCE="yes"
>
</head>
<script language="vbscript">
<!-- Insert code, subroutines, and functions here -->
Sub Window_Onload
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

Set colAccounts = GetObject("WinNT://" & strComputer & "")
colAccounts.Filter = Array("user")

For Each objUser In colAccounts

 Set objOption = Document.createElement("OPTION")
 objOption.Text = objUser.Name
 objOption.Value = objUser.Name
 optUsers.Add(objOption)

Next
End Sub
Sub Add()
Set objOption = Document.createElement("OPTION")
objOption.Text = optUsers.value
objOption.Value = optUsers.value
optUsersToDo.Add(objOption)
End Sub
Sub Remove()
' what goes here?
End Sub
</script>
<body>
<table border="1"> 
<tr>
 <td>
  <select size="8" style="width:200px"name="optUsers"></select>
 </td>
  
 <td align="center">
  <input type="button" value="Add In-->" name="RunButton" onClick="Add">
  <br><br>
  <input type="button" value="<--Remove" name="RunButton1" onClick="Remove">
 </td>
  
 <td>
  <select size="8" style="width:200px" name="optUsersToDo"></select>
 </td>
</tr>
</table>
</body>
</html>
 
 
Post #: 1
 
 RE: How do i remove an item from HTA list box? - 6/23/2008 11:54:14 PM   
  ebgreen


Posts: 4950
Score: 31
Joined: 7/12/2005
Status: online
Look at the .Remove method of the Select object http://msdn.microsoft.com/en-us/library/ms536694(VS.85).aspx

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to struttshumming)
 
 
Post #: 2
 
 RE: How do i remove an item from HTA list box? - 6/24/2008 12:27:59 AM   
  struttshumming

 

Posts: 8
Score: 0
Joined: 3/14/2008
Status: offline
Cool, Just the job.

Thanks M8:)


(in reply to ebgreen)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How do i remove an item from HTA list box? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts