Created
February 18, 2019 14:34
Powershell - Show Messagebox by condition
This file contains hidden or 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