title: Raise custom events in C# WinForms
body: <p>I have some Events I created on my own and was wondering on how to raise them when I want.</p>
  
  <p>Probably my application design is also messed up, might take a look at that if you like.</p>
  
  <p>This is the Structure</p>
  
  <pre><code>ProgramContext
   - Form MainWindow
    + Control TextBox
    + Control Button
    + ...
  </code></pre>
  
  <p>In this case, the <code>MainWindow.TextBox</code> holds some information that is updated quite often at runtime. So, I somehow need it to refresh itself when I want to (so it can reload its data from the database, where the it's stored)</p>
  
  <p>I tried hooking an <code>EventHandler</code> to its <code>Validating</code>-Event, but that didn't seem to do the trick.</p>
  
  <p>So, basically I have a method that reloads the data in <code>ProgramContext</code></p>
  
  <pre><code>DataTable table = _adapter.GetData();
  foreach (DataRow row in table.Rows)
  {
    MainWindow.TextBox.Text += table.Text.ToString();
  }
  </code></pre>
  
  <p>That needs to be done whenever another method (that writes new data into <code>table</code>) is executed.</p>
  
  <p>Any ideas?</p>