1RedOne / 1redone.github.io

FoxDeploy's GitHub.io Page
https://1redone.github.io/
MIT License
6 stars 3 forks source link

Adding Autocomplete to your Textbox forms in PowerShell #45

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

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

ecureuilfourbe commented 2 years ago

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 !