Use if statement :
' data type infered from ifTrue and ifFalse ... = If(condition, ifTrue, ifFalse)
This operator was introduced in VB.NET 9 (released with the .net Framework 3.5). In earlier versions, you would have to resort to the IIf function (no type inference, no short circuit):
' always returns Object, always evaluates both ifTrue and ifFalse ... = IIf(condition, ifTrue, ifFalse)
Heinzi
source share