C# I have got NullReferenceException when I was making textbox for finding name in column in DGV : <p>I have problem with textbox finding I have got this piece of program to make "Starts With" method to find it by putting three letters into the textbox and it will find all that matches with three starting letters. Here is the code I have used</p>

<pre><code>    private void findTextBox_TextChanged(object sender, EventArgs e)
    {
        var bd = (BindingSource)debtDGV.DataSource;
        var dt = (DataTable)bd.DataSource;
        dt.DefaultView.RowFilter = string.Format(" '{0}%'", findTextBox.Text.Trim().Replace("'", "''"));
        debtDGV.Refresh();
    }
</code></pre>
