Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement