1RedOne/1redone.github.io

Adding Autocomplete to your Textbox forms in PowerShell

utterances-bot opened this issue · 1 comments

Adding Autocomplete to your Textbox forms in PowerShell

FoxDeploy.com, Stephen Owen's technical blog about
PowerShell, Systems Administration, GUI Design and Programming.
.

https://www.foxdeploy.com/blog/adding-autocomplete-to-your-textbox-forms-in-powershell.html

Just because I find the tutorial a little bit confusing for me as a beginner, there somme change you can make:

-transform the ligne :

Get-content 'C:\Any\Path\User Records.txt' | % {$textbox.AutoCompleteCustomSource.AddRange($_) }

into:

$aVariable = Get-content 'C:\Any\Path\User Records.txt'
$textbox.AutoCompleteCustomSource.AddRange($aVariable)

and :

$textbox.AutoCompleteSource = 'CustomSource' $textbox.AutoCompleteMode='SuggestAppend' $textbox.AutoCompleteCustomSource=$autocomplete

into (3 differents lines):

$textbox.AutoCompleteSource = 'CustomSource'

$textbox.AutoCompleteMode='SuggestAppend'

$textbox.AutoCompleteCustomSource=$autocomplete

It's less compact but easier to understand (and the first Get Content doesn't work for me anyway)

Have a nice day !