Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set dynamic HTA Listbox Default Option with VBscript

Status
Not open for further replies.

BNSGuy

Technical User
Feb 13, 2010
2
0
0
US
ok.. heres the deal.

I'm creating a listbox (actually 2) that contains the IP Address (and MAC address).

Listbox could contain 1 or more items, depending on the number of physical interfaces.

Listbox value population is ok, pulling from Win32_NetworkAdapter.

Problem: I'd like the default (i.e. selected) option to be the first adapter connected to a given subnet. I can populate all the options just fine. Also, there's no problem determining which adapter(s), if any, are connected to a given subnet, but the problem is how to set the default to the desired adapter.

Why?
This has to be dynamic, because many hosts have multiple native adapters, and some have at least one multi-port NICs installed. (one machine has 18 physical ports! -- two built in to the motherboard, and 4 4-port adapters) Unfortunately, there is no way to know for certain, in advance, which physical port(s) is connected to a given subnet.

Any help would be appreciated.
 
During the building of the "listbox", says the object being referred to as osel, these pieces of information should be available to the process:

[1] Either it knows the index of the targetted option, say n, then you can add a line like this to it.
[tt] osel.selectedIndex=n[/tt]

[2] Or it knows the value of the targetted option, say svalue, then you can add a line like this to it.
[tt] osel.value=svalue[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top