title: MVP pattern in winforms - Handling events
body: <p>I just started with C# and MVP design pattern.
  I'm in doubt about concrete implementation when it comes to event handling. I'm aware of that, view shouldn't know about presenter and presenter should control a view through view interface.</p>
  
  <p>Let's say I have 2 text boxes and would like to check for errors. If an error occurs I want to change text box Text property. Is it wrong approach to create one EventHandler and use sender object to verify witch text box is user currently using?</p>
  
  <p>Something like:</p>
  
  <p>IView:</p>
  
  <pre><code>interface IMainView
  {
      event KeyPressEventHandler KeyPressed;
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>public partial class MainView : Form, IMainView
  {
      public frmInterakcija()
      {
          InitializeComponent();
          this.textBox1.Name = "textBox1";
          this.textBox2.Name = "textBox2";
          new MainPresenter();
          Bind();
      }
  
      private void Bind()
      {
  
         this.textBox1.KeyPress += KeyPressed;
         this.textBox2.KeyPress += KeyPressed;
      }
  }
  </code></pre>
  
  <p>Presenter:</p>
  
  <pre><code>class MainPresenter
  {
      private IMainView _view;
  
      public MainPresenter(IMainView view) 
      {
          _view = view;
          this.initialize();
  
      }
  
      public void initialize()
      {
          _view.KeyPressed += _view_textBoxKeyPressed;
      }
  
      public void _view_textBoxKeyPressed(object sender, EventArgs e)
      {
          if (sender.GetType() == typeof(TextBox))
          {
              TextBox textBox = (TextBox)sender;
              if (textBox.Name.Equals("textbox1") 
                  {...} // Do validation/changes on textbox1
              else ...
  
          }
      }
   }
  </code></pre>
  
  <p>Or instead of this above I should create event handler for every textbox I have and update/handle errors through properties? (this will make my code redundant I guess)</p>
  
  <p>What would be right approach?</p>