Advertisement
hiro1357

textbox.ps1

Oct 27th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Add-Type -AssemblyName System.Windows.Forms
  2.  
  3. Function Button1_Click() {
  4.     If ([Windows.Forms.MessageBox]::Show($TextBox1.Text + "`n`nAre you sure?", "Question", [Windows.Forms.MessageBoxButtons]::YesNo) -eq [Windows.Forms.DialogResult]::Yes) {
  5.         [Windows.Forms.MessageBox]::Show("Action!")
  6.     }
  7. }
  8.  
  9. $Form1 = New-Object System.Windows.Forms.Form
  10. $Form1.Text = "ask you"
  11. $Form1.Width = 275
  12. $Form1.Height = 330
  13. $Form1.FormBorderStyle = [Windows.Forms.FormBorderStyle]::Fixed3D
  14.  
  15. $Button1 = New-Object System.Windows.Forms.Button
  16. $Button1.Text = "go"
  17. $Button1.Top = 260
  18. $Button1.Left = 90
  19. $Button1.Add_Click({Button1_Click})
  20.  
  21. $TextBox1 = New-Object System.Windows.Forms.TextBox
  22. $TextBox1.Multiline = $True
  23. $TextBox1.Left = 10
  24. $TextBox1.Top = 10
  25. $TextBox1.Width = 240
  26. $TextBox1.Height = 240
  27. $TextBox1.ScrollBars = [System.Windows.Forms.ScrollBars]::Both
  28.  
  29. $Form1.Controls.Add($Button1)
  30. $Form1.Controls.Add($TextBox1)
  31. $Form1.ShowDialog()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement