Created
February 18, 2019 14:34
-
-
Save codeonion/d33326512d0d4837cc6c76b23a8fe5f5 to your computer and use it in GitHub Desktop.
Powershell - Show Messagebox by condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# This form was created using POSHGUI.com a free online gui designer for PowerShell | |
.NAME | |
Untitled | |
#> | |
Add-Type -AssemblyName System.Windows.Forms | |
[System.Windows.Forms.Application]::EnableVisualStyles() | |
$Form = New-Object system.Windows.Forms.Form | |
$Form.ClientSize = '400,400' | |
$Form.text = "Form" | |
$Form.TopMost = $false | |
$tb_payerid = New-Object system.Windows.Forms.TextBox | |
$tb_payerid.multiline = $false | |
$tb_payerid.width = 100 | |
$tb_payerid.height = 20 | |
$tb_payerid.location = New-Object System.Drawing.Point(135,60) | |
$tb_payerid.Font = 'Microsoft Sans Serif,10' | |
$Button1 = New-Object system.Windows.Forms.Button | |
$Button1.text = "button" | |
$Button1.width = 60 | |
$Button1.height = 30 | |
$Button1.location = New-Object System.Drawing.Point(161,144) | |
$Button1.Font = 'Microsoft Sans Serif,10' | |
$Form.controls.AddRange(@($tb_payerid,$Button1)) | |
$Button1.Add_Click({ validate }) | |
$Form.ShowDialog() | |
function validate(){ | |
if($tb_payerid.Text.Length -gt 0){ | |
[System.Windows.MessageBox]::Show('Missing Payer ID') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment