Martin Verjans Martin Verjans - 1 year ago 63 Question

if() not recognized in VB .Net 3.5 VS2012

I just asked a question, where the answer proposed to use the


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...

Answer Source

The If() operator returns a value, try:

Debug.Write(If(True, "A", "B"))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download