First off, it is best to use a parameterised query rather than concatenating strings like this
com = new SqlCommand("SELECT middle, last FROM Table2 WHERE first = @firstName", con);
com.Parameters.AddWithValue(@firstName", textBox1.Text.Trim());
Then you can use dr.HasRows instead of using a temp bool variable like this:-
if(dr.HasRows)
{
while(dr.Read())
{
txtLast.Text = (string)dr[0];
txtMiddle.Text = (string)dr[1];
}
dr.Close();
}
else
{
MessageBox.Show("Not found !");
}