title: Powershell - Check if Text Box Contents Have Changed
body: <p>Is there anyway I can check if the contents of a text box has changed?</p>
  
  <p>Say, for example, I made a text box:</p>
  
  <pre><code>$InputBox1 = New-Object System.Windows.Forms.TextBox 
  $InputBox1.Location = New-Object System.Drawing.Size(20,50) 
  $InputBox1.Size = New-Object System.Drawing.Size(150,20) 
  $objForm.Controls.Add($InputBox1) 
  </code></pre>
  
  <p>Then I set an output to the textbox:</p>
  
  <pre><code> $InputBox1.text= "Hello"
  </code></pre>
  
  <p>I want to know if there is an event handler that can detect if the contents of the text box have been changed (after initial loading in the GUI - that is, when InputBox1.text becomes != Hello)</p>
  
  <p>It has to detect it real-time - meaning that anytime the user clicks the textbox and alters the content - an event is raised which can be used as a condition to modify other parts of the code.</p>
  
  <p>Basic breakdown on what I need to do:</p>
  
  <ol>
  <li>Gets a value from Active Directory (i.e. accountname)</li>
  <li>UI is loaded. Account Name is loaded into the textbox.</li>
  <li>If user modifies contents of a textbox, enable a button to allow saving the new value.</li>
  </ol>
  
  <p>I have a working code which stores the current value and puts the entire function into a "wait for text change" loop but am looking for a more elegant way to get it done.</p>