The problem is that Not has higher precedence than = so it is done first.
There is a table of operator precedence in the Expressions section of the Language Reference.
There is a table of operator precedence in the Expressions section of the Language Reference.