The editor in VB is somewhat intelligent, and it checks for certain kinds of syntax errors as code is typed. In our previous example, as soon as the first line is typed, and the ENTER key pressed, the editor will complain about a “Compile error”, and indicated that a close parenthesis is expected. The line will also be highlighted in red.
However, if you forget to type the last line (End If), the VB editor does not complain. This is because in VB6, syntax error checking is only performed on a line-by-line basis. The editor does not make sure all If constructs have matching End If markers.