Product, version and build: SAPIEN PowerShell Studio 2020, Version 5.7.180
Operating system: Windows 10, 10.0.18363
PowerShell version: 5.1.18362.752
32 or 64 bit OS: 64
I'm new to PowerShell Studio and forms. How can I build a Listbox with a drop down list that is populated from an XML file? I want to use this to make selections from the listbox and store the results in an object.
Populating a Listbox from an XML file
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.
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.
- james burger
- Posts: 4
- Last visit: Thu Nov 05, 2020 8:49 am
Re: Populating a Listbox from an XML file
[Topic moved to PowerShell GUIs by moderator]
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- james burger
- Posts: 4
- Last visit: Thu Nov 05, 2020 8:49 am
Re: Populating a Listbox from an XML file
Thanks for your reply. So I'm new to forms but not PowerShell and scripting. The only thing I have tried was using the controls on the form. I got the listbox to work by populating "Items" list. I guess before I read the items in from and XML file I need to know how to populate the items from an array. Can you help with this? do you have any examples?
On a related question, how to I make the Listbox behave as a dropdown list instead of the scrolling controls on the side?
On a related question, how to I make the Listbox behave as a dropdown list instead of the scrolling controls on the side?
Re: Populating a Listbox from an XML file
$listbox1.Itema.AddRange($array)
The toolbox controls can be right-clicked and the menu has links to the docs and SpotLight articles that give examples of how to work with most controls.
The toolbox controls can be right-clicked and the menu has links to the docs and SpotLight articles that give examples of how to work with most controls.
- james burger
- Posts: 4
- Last visit: Thu Nov 05, 2020 8:49 am
Re: Populating a Listbox from an XML file
there are no Spotlight articles for this and the MSDN examples are all C# instead of PowerShell.
Re: Populating a Listbox from an XML file
The MSDN docs explain how each property/method/event work. C# is very similar to PowerShell so it provides some clues.
The first thing that is required to use forms is to read the articles in the Info Center that will help you to understand what forms are and how they are intended to be used. Without some basic learning forms will be very challenging application of PowerShell. Forms also requires more than just a passing knowledge of PowerShell. You will have to learn PowerShell at a more fundamental level.
You will also need to learn how to read technical documentation. The links will take you to the available objects and the properties and methods of those objects. "Items" is a collection of special objects. Take time to learn to navigate and understand teh docs.
With form there are many thousands or properties/methods and events that are available. It is nearly impossible for anyone to answer every question without referencing the docs. WinForms is one of the largest APIs anywhere for a single subsystem. Learning how it is deployed is critical to using it in more than the simplest way. For simple forms the InfoCenter has almost everything you need along with many examples.
For the "Items" collection method see the following.
https://docs.microsoft.com/en-us/dotnet ... tem_Object___
The first thing that is required to use forms is to read the articles in the Info Center that will help you to understand what forms are and how they are intended to be used. Without some basic learning forms will be very challenging application of PowerShell. Forms also requires more than just a passing knowledge of PowerShell. You will have to learn PowerShell at a more fundamental level.
You will also need to learn how to read technical documentation. The links will take you to the available objects and the properties and methods of those objects. "Items" is a collection of special objects. Take time to learn to navigate and understand teh docs.
With form there are many thousands or properties/methods and events that are available. It is nearly impossible for anyone to answer every question without referencing the docs. WinForms is one of the largest APIs anywhere for a single subsystem. Learning how it is deployed is critical to using it in more than the simplest way. For simple forms the InfoCenter has almost everything you need along with many examples.
For the "Items" collection method see the following.
https://docs.microsoft.com/en-us/dotnet ... tem_Object___