Click here to Skip to main content
15,074,987 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
VB
HeadersLiteral.Text = If(contentType IsNot Nothing ,  "Content-Type: " & contentType & "<br />", String.Empty))
            HeadersLiteral.Text += (If(contentTransferEncoding IsNot Nothing, "Content-Transfer-Encoding: " & contentTransferEncoding, String.Empty)


The error is shown on if condition.
Any one please solve the error and please make an update.

error: experssion expected
Posted
Updated 8-Jun-11 21:28pm
v3
Comments
   
Tag the question properly: language, platform, UI library if applicable, etc.
--SA

Under "if" statement Boolean expression is expected: result of comparison or result of Boolean operator. Isn't that natural? It should be something returning True or False. Instead, you write Boolean expressions delimited by ',' (comma). Comma is not a Boolean operator.

—SA
   
If appears as if you wrote your If statements like you were writing them in Excel:
If(condition, returnIfTrue, returnIfFalse)


That's not how it work in VB.NET:
If condition Then
    statementsIfTrue
Else
    statementsIfFalse
End If
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900