hiro1357 icon

textbox.ps1

hiro1357 | PRO | 10/27/15 06:52:18 AM UTC | 0 ⭐ | 467 👁️ | Never ⏰ | []
PowerShell |

940 B

|

None

|

0 👍

/

0 👎

Add-Type -AssemblyName System.Windows.Forms
 
Function Button1_Click() {
    If ([Windows.Forms.MessageBox]::Show($TextBox1.Text + "`n`nAre you sure?", "Question", [Windows.Forms.MessageBoxButtons]::YesNo) -eq [Windows.Forms.DialogResult]::Yes) {
        [Windows.Forms.MessageBox]::Show("Action!")
    }
}
 
$Form1 = New-Object System.Windows.Forms.Form
$Form1.Text = "ask you"
$Form1.Width = 275
$Form1.Height = 330
$Form1.FormBorderStyle = [Windows.Forms.FormBorderStyle]::Fixed3D
 
$Button1 = New-Object System.Windows.Forms.Button
$Button1.Text = "go"
$Button1.Top = 260
$Button1.Left = 90
$Button1.Add_Click({Button1_Click})
 
$TextBox1 = New-Object System.Windows.Forms.TextBox
$TextBox1.Multiline = $True
$TextBox1.Left = 10
$TextBox1.Top = 10
$TextBox1.Width = 240
$TextBox1.Height = 240
$TextBox1.ScrollBars = [System.Windows.Forms.ScrollBars]::Both
 
$Form1.Controls.Add($Button1)
$Form1.Controls.Add($TextBox1)
$Form1.ShowDialog()

Comments