Posts Tagged ‘forms’


Write a Multi-Form PowerShell GUI App

Tuesday, July 26th, 2016 by June Blender
Tested on: PowerShell 2.0+, PowerShell Studio 2016 This step-by-step example shows you how to create a very simple multi-form PowerShell GUI app. The app consists of a parent form that gets data from a child form and displays it. When you finish, you'll know how to use the basic multi-form features of PowerShell Studio. For details about how these features work under the covers, see How Do Multi-Form Projects Work? For this task, we assume that you know how to create a single-form PowerShell GUI app or that you've participated in a Thinking in Events hands-on lab. Otherwise, start with…   More »

How I learned to love DialogResult

Wednesday, December 23rd, 2015 by June Blender
This post discusses the DialogResult property of buttons, which often confuses beginning PowerShell GUI app designers. When I first started learning how to write PowerShell GUI applications, I thought of the DialogResult property of buttons as the "evil property." What else would I think? If the DialogResult property of a button is set to any value other than None, when you click the button, the GUI app closes immediately after running the commands in my event handler. In this little app, when you click OK, it pipes a Get-Service command to Out-GridView -- um, very briefly. [video width="1280" height="670" mp4=""][/video]…   More »

PowerShellGet-GUI Part 2

Thursday, November 12th, 2015 by Ferdinand Rios
Continuing on from where we left off in our last blog post entitled "PowerShellGet-GUI part 1", let us examine some of the other features of the PowerShell Get GUI application. With our list successfully loaded with PowerShell Gallery modules, the user can take several actions: Select a module to inspect it's properties Select a non-installed module to install it Select an installed module to uninstall it Case 1 [caption id="attachment_10223" align="aligncenter" width="1273"] Figure 1[/caption] When the user clicks on an item in the list, the listview_ItemSelectionChanged event fires and is handled by our $lvModules_ItemSelectionChanged event handler seen in Figure 1…   More »

PowerShellGet-GUI Part 1

Tuesday, November 10th, 2015 by Ferdinand Rios
Back in mid-September, I presented a talk on "Building PowerShell GUI Tool Solutions" at the PowerShell Conference Asia in Singapore. The talk centered around GUI application design and development using PowerShell as the core language. During that talk , I developed an application that used PowerShell's PSGet module to communicate with the PowerShell Gallery. Finishing work was done by Devin Leaman of SAPIEN Technologies. The recorded talk should be available at some point on the PowerShell Conference Asia Website. The application creates an interface that displays gallery module information and allows the user to easily add and remove modules from their…   More »

PowerShell Studio 2012 – WinForms – GUI ToolMaking

Wednesday, October 16th, 2013 by David Corrales
Francois-Xavier Cat over at the LazyWinAdmin blog, wrote a follow up article to Creating a GUI with PowerShell Studio. Like the previous article, a video is included:   “Today I will go a bit further and show you how to create a tool to query some information from a remote computer. I will first send the Output to Out-GridView cmdlet and then show you how to send it to a DataGridView control inside the GUI.”     Read the full article here:   Thank you once again Francois-Xavier!…   More »

Creating a GUI with PowerShell Studio

Tuesday, October 8th, 2013 by David Corrales
Francois-Xavier Cat over at the LazyWinAdmin blog, wrote a great article on how to create a basic GUI using PowerShell Studio 2012. In addition, the article includes a video of the process:   “The following post will demo how to create a basic Graphical User Interface with SAPIEN PowerShell Studio 2012. Last year I released a PowerShell script called LazyWinAdmin 0.4 which is a script that generate a Graphical User Interface. I used SAPIEN PowerShell Studio 2012 to create this Interface and write my PowerShell code.” Read the full article here:   Thank you for the article Francois-Xavier!…   More »

PowerShell Studio 2012: Form Recovery

Monday, August 20th, 2012 by David Corrales
Over time we have had various users who needed to alter the form but lost the original pff file. These users only had an exported GUI script. Naturally they would ask us if they could recover the original form from the exported script. The only solution was to recreate the form by hand and manually paste the event scripts into the new form. Fortunately, this is no longer the case. The latest service build of PowerShell Studio (v3.0.8) has a new Data Recovery feature to prevent this scenario from occurring again. This article will help answer any questions you may…   More »

PrimalForms 2011: Validating the Form – Part 4

Friday, September 23rd, 2011 by David Corrales
In Part 3 we discussed validating techniques. Now in the final part of this series we will discuss how to validate the form as a whole. How to Trigger Validation when the Form is Closing: If you have worked with validation in the past, you may have noticed that the unfocused controls do not trigger validation when the form closes. To get around the issue, you can explicitly tell the form to validate its child controls and react accordingly. A good place to trigger the validation is in the form’s FormClosing event:$form1_FormClosing=[System.Windows.Forms.FormClosingEventHandler]{ #Event Argument: $_ = [System.Windows.Forms.FormClosingEventArgs] #Validate only on…   More »

PrimalForms 2011: Validating the Form – Part 3

Wednesday, September 21st, 2011 by David Corrales
In Part 2 we discussed how to validate a control. Now we will cover some techniques that can be utilize for validation. Validating Techniques: Regular Expressions: For more complex validation, such as validating an email address, you may need to rely on Regular Expressions. Regular expressions are useful because it allows you to match complex data by providing formatting information. In addition, PowerShell has built in support for regular expressions in the form of the –match operator. Example use of a regular expression in PowerShell: "PowerShell" -match "shell" In this example we are matching any string that contains the word…   More »

PrimalForms 2011: Validating the Form – Part 2

Friday, September 9th, 2011 by David Corrales
In Part 1 we discussed the import events and properties that are needed for validation. Now we will discuss how to validate a control.  How do I validate a control? As it turns out, validating controls depends on what type of control and the format of the data you wish to validate. Typically you will be validating text that is provided by a TextBox, but it could also come from a ComboBox where the user can type their selection. As for validating the text, it can range from simply ensuring there is value (i.e., not an empty string) or more…   More »