Jeremy F.
Jeremy F.

Reputation: 1880

VB.NET: End of Statement error on IF statement

I have the following IF statement and I am getting an 'End of Statement' error under: not in ('Deferred','Rejected','Closed')

 If (temp_var_1 = temp_var_2) And temp_var_3 not in ("Deferred","Rejected","Closed") Then

If I put parentheses around temp_var_3 and the right most ')', under not I get: ')' expected

If (temp_var_1 = temp_var_2) And (temp_var_3 not in ("Deferred","Rejected","Closed")) Then

A few notes:

Upvotes: 1

Views: 506

Answers (1)

Andrew Morton
Andrew Morton

Reputation: 25066

If (temp_var_1 = temp_var_2) AndAlso (Not {"Deferred", "Rejected", "Closed"}.Contains(temp_var_3)) Then

Also, if you put Option Strict On at the top of the file it will help you find errors.

Upvotes: 4

Related Questions