Question

Work :

publicity.Target = IIF(radioTarget1.Checked, "_blank", "_self").toString

Doesn't work :

IIF(radioTarget1.Checked, publicity.Target = "_blank", publicity.Target = "_self")

Why isn't the second option working?

Was it helpful?

Solution

Because it's not assignments you are doing inside the function call, it's comparisons.

It does the same as:

Dim result As Boolean
If radioTarget1.Checked Then
  result = (publicity.Target = "_blank")
Else
  result = (publicity.Target = "_self")
End If

OTHER TIPS

IIF is a function, not a language feature.

The second two parameters are objects that are potential return values of the function... not a block of code.

http://msdn.microsoft.com/en-us/library/27ydhh0d%28v=VS.90%29.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top