Listview question...
I am making a listview box of, for example, aa, aab, ba, bb, cc. I can populate the box with no issues (call it $listbox1)
I have a seperate textbox that accepts user input. On any text change, I want to hightlight the item in thej list box.
$mgmtgroupsall is my listbox. What I am missing is how to programatically set the $MgmtGroupsAll listbox to have item #3 highlighted (as if I had chosen the scroll bar to show it). In other words, I have a list of club members (about 4000). I want to be able to type "Smith" to then have the list box take me to the first line that starts with Smith. I can get whatline number that line is, but where to I tell the listbox that it should be displaying item 200 (or 300, etc) in the list?
$MgmtGroupLookup is a text box
--------------
$MgmtGroupLookup_TextChanged={
$start= [int]0
$lookup = $([string]$mgmtgrouplookup.text)
write-debug "Starting record $($start) with a look up of ($lookup)"
for ($ct=$start;$ct-lt$mgmtgroupsall.Items.Count; $ct++)
{
if ($([string]$mgmtgroupsall.Items[$ct]).startswith($lookup))
{
# This does not work...
$MgmtGroupsAll.SelectedItem =$ct
write-host "Line $($ct) is what should be highlighted"
break
}
}