Вопрос

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?

Это было полезно?

Решение

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

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top