Support Forums

Confirmation box?

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
User avatar
bheidemann
Posts: 19
Joined: Wed Sep 30, 2009 2:50 am

Confirmation box?

Postby bheidemann » Mon Mar 04, 2013 11:50 am

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
User avatar
davidc
Posts: 4354
Joined: Thu Aug 18, 2011 4:56 am

Re: Confirmation box?

Postby davidc » Mon Mar 04, 2013 12:07 pm

You can use the messagebox:

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.
User avatar
bheidemann
Posts: 19
Joined: Wed Sep 30, 2009 2:50 am

Re: Confirmation box?

Postby bheidemann » Mon Mar 04, 2013 12:13 pm

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.
User avatar
davidc
Posts: 4354
Joined: Thu Aug 18, 2011 4:56 am

Re: Confirmation box?

Postby davidc » Tue Mar 05, 2013 10:09 am

One of the inputs to the message box allows you to specify the buttons to display:

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.

Return to “PrimalForms”

Who is online

Users browsing this forum: No registered users and 2 guests