A simple form:
PowerShell Code
Double-click the code block to select all.$form1_Load={ #TODO: Initialize Form Controls here $list = Get-Content "c:\list.txt" } $textbox1_TextChanged={ #TODO: Place custom script here $textbox1.AutoCompleteCustomSource.AddRange($list) } $button1_Click={ #TODO: Place custom script here #[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") [void][System.Windows.Forms.MessageBox]::Show("Selected = $($textbox1.Text)","") }What I would like to do is if an item is not in the list, when I click button1 it is added to $list(file) and the msgbox is then presented again
It does not add if it already exists so std append is no good
What I would also like is $list to be displayed as is. ie. $list contains:
- One
Two
Three
PowerShell Code
Double-click the code block to select all.$textbox1.AutoCompleteCustomSource.AddRange($list)The list is sorted alphabetically
Any help?
Thanks in advance