Q: Have Text Box Event In Different Class I am sure it is not good practice to do something like this, but I was just curious if it is possible....
I attempted using Visual Studio 2015 but I received multiple compile errors ( to many to post) - but essentially what I was curious about is if you can have the _Leave() event of a text box in a different class.  Something like the below
namespace BlueGreenRed
{
    public partial class Red : UserControl
    {
        //In this class I have a text box called txtName
    }
}



namespace BlueGreenRed
{
    class ReusableMethods
    {
        private void txtName_Leave(object sender, EventArgs e)
        {
            //Do something here
        }
    }
}


A: Sure you could do this:
public class Red 
{
    public TextBox TxtName {get; set; }
}

public static class ReusableMethods
{
    public static void WireUp(Red red)
    {
         red.TxtName.Leave += txtName_Leave;
    }

    private static void txtName_Leave(object sender, EventArgs e)
    {
        //Do something here
    }
}

//some other code

var red1 = new Red() { TxtName = new TextBox() };
var red2 = new Red() { TxtName = new TextBox() };

ReusableMethods.WireUp(red1);
ReusableMethods.WireUp(red2);

