Link to home
Start Free TrialLog in
Avatar of piattnd
piattnd

asked on

Dynamic Listbox for HTA using VBscript

Experts,

I'm looking for a "professional appearance" solution for the following:

User input will calculate what usernames match the information provided by the user.  Say the first letter input by the user is the letter N.  All entries that start with the letter N will be populated into a listbox.  I have the population of the listbox working.

The second part I need the VB to do is REMOVE items from the listbox that no longer match the input from the user.  For example the first letter was N and the second letter is A.  Anything that doesn't start with "Na" would be removed from the list and so on.

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of rejoinder
rejoinder
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of piattnd
piattnd

ASKER

Thank you for the code.  I also found a way to do it via a listbox and identifying which entry doesn't match, then removing them; however, I encounter a problem repopulating them again if the user backspaces a letter out.
Avatar of piattnd

ASKER

Thanks, I'll give this a shot.
Glad to help out.  If you like the second method, there are ways to add additional columns to the list as well as small images.
Avatar of piattnd

ASKER

If you're still out there, I've dumped all user names from an AD query into a dictionary file.  I then want to dump those into the listbox and perform the filtering as you had shown in the second example.

I'm having a problem with the command to add the items into the list.  Can you still help?  Below is what I had toyed around with, nothing is working.
Sub BuildList
 
'Set objList = document.getElementByID( "lst_UserNames" )
'objList.ListItems.Clear
 
For Each strUser in dicUserNameList
	'Set objListItem = objListItem.Add
	'objListItem.Text = strUser
	txt_filterUserNames.AddItem strUser
Next
 
End Sub

Open in new window

Try changing the sub to this...
Sub BuildList
    Set objList = document.getElementByID( "lst_UserNames" )
    objList.ListItems.Clear
    for each User in dicUserNameList
        Set objListItem  = objList.ListItems.Add
        objListItem.Text = User
    next
End Sub

Open in new window

Avatar of piattnd

ASKER

I'll post up another question with my scenario, I think it's too in depth now to continue on this question
OK.

When you post the new question, can you add a comment with a link to the new URL please?


Thanks.