C#, "Object reference not set to an instance of an object." error
<p>I've got this code...</p>

<pre><code>namespace YellowBox
{
    public partial class Form1 : Form
    {

        private string sid = "";

        FileTransferManager fm = new FileTransferManager();
        Jid _jid = new Jid();


        public Form1()
        {
            InitializeComponent();

            fm.OnError += fm_OnError;
            fm.OnEnd += fm_OnEnd;
            fm.OnStart += fm_OnStart;
            fm.OnProgress += fm_OnProgress;
        }

        private void btn_pickFile_Click(object sender, System.EventArgs e)
        {
            var of = new OpenFileDialog();
            if (of.ShowDialog() == DialogResult.OK)
            {
                tb_file.Text = of.FileName;

                var fi = new FileInfo(of.FileName);
                //lblSize.Text = Util.HumanReadableFileSize(fi.Length);

                btn_sendFile.Enabled = true;
            }
        }

        private void btn_sendFile_Click(object sender, System.EventArgs e)
        {

        _jid.Server = "xxx";
        _jid.User = "xxx";  /// EDIT, added the _jid values.
        _jid.Resource = "xxx";

            sid = fm.Send(_jid, tb_file.Text, ""); /// HERE IT SAYS "Object reference not set to an instance of an object." ???
            btn_sendFile.Enabled = false;
            btn_pickFile.Enabled = false;
        }

...
</code></pre>

<p>And when I hit the btn_sendFile it gives me a "Object reference not set to an instance of an object." error. But I had instanced the fm object in FileTransferManager fm = new FileTransferManager(); , didn't I?</p>

<p><strong>SOLVED:
Appears it was missing fm.XmppClient = xmppClient;</strong></p>
