
IIF is not a language feature but a function within the Microsoft.VisualBasic namespace
IIF function could be better implemented by using generics (to avoid the typecasting).
Syntax
Public Function IIf(Of T)(ByVal expression As Boolean, _
ByVal truePart As T, ByVal falsePart As T) As T
If expression Then
Return truePart
Else
Return falsePart
End If
End Function
Example----
If expression is true TruePart is returned, otherwise FalsePart is returned.
Dim StdBool As Long, VbBool As Boolean
VbBool = False
StdBool = IIf(VbBool, 1, 0)
Mark as answer if it is helpful...
Regards,
Vikash Pathak
Maheshvishnu, if this helps please login to Mark As Answer. | Alert Moderator