Adding textboxes

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 10 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
JorisK
Posts: 12
Last visit: Wed May 07, 2014 6:42 am

Adding textboxes

Post by JorisK »

Hi,

I need some help with figuring out what the best method would be to archive the following:

I have one Combobox, where you can select 1 to 100. If you select for example 5, then 5 textboxes should appear. If you make it 20, then 20 textboxes should appear. I want to use the content of textboxes later on in some powershell script that generates ActiveDirectory Objects.

For me it is not really clear how to archive this.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Adding textboxes

Post by jvierra »

PowerShell Code
Double-click the code block to select all.
1..5 | 
    ForEach-Object{
       $tb=New-Object System.Sindows.Forms.Textbox
       # set properties
       $form1.Controls.Add($tb)
    }
You now have5 new textboxes.
This topic is 10 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked