Martin Verjans
Martin Verjans

Reputation: 4796

if() not recognized in VB .Net 3.5 VS2012

I just asked a question, where the answer proposed to use the If() function.

I tried in my Visual Studio, but it seems not present...

Here is a screenshot of the Intellisense : enter image description here

It only shows me the classical If structure.

When I write it out completely

If(True, Debug.Write("A"), Debug.Write("B"))

I get a syntax error, saying :

If must end by a corresponding End If

What am I missing here ?

.Net Framework 3.5

Visual Studio 2012 Express

The project is a Console Application and I tried also in Winforms...

Upvotes: 0

Views: 100

Answers (1)

rheitzman
rheitzman

Reputation: 2297

The If() operator returns a value, try:

Debug.Write(If(True, "A", "B"))

Upvotes: 3

Related Questions