Confirmation box?
- bheidemann
- Posts: 19
- Last visit: Mon Dec 09, 2013 9:11 am
Confirmation box?
How could I make a simple confirmation box? I have an action tied to a button but I would like the user to confirm the action before it takes place. Thank you
Re: Confirmation box?
You can use the messagebox:
David
PowerShell Code
Double-click the code block to select all.if([System.Windows.Forms.MessageBox]::Show(\"Text\",\"Caption\") -eq \'OK\') { #run script }PrimalForms 2011 & PowerShell Studio 2012 have a snippet called \"msgbox\" you can use.
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- bheidemann
- Posts: 19
- Last visit: Mon Dec 09, 2013 9:11 am
Re: Confirmation box?
Where can I get more info on the message box? I like your example but there isn\'t a way for the user to cancel out of it.
Re: Confirmation box?
One of the inputs to the message box allows you to specify the buttons to display:
http://msdn.microsoft.com/en-us/library ... .Show.aspx
David
PowerShell Code
Double-click the code block to select all.if([System.Windows.Forms.MessageBox]::Show("Continue?", "Question",[System.Windows.Forms.MessageBoxButtons]::OKCancel) -eq "OK") { Write-Host "OK!" }Here is the MSDN help for the messagebox:
http://msdn.microsoft.com/en-us/library ... .Show.aspx
David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.