Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIf not working as expected?
Message
From
14/06/2006 12:34:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
14/06/2006 11:59:09
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01129039
Message ID:
01129079
Views:
11
>>The following line is not working as expected:
>>
>>
>>Dim lcImpDate As String  = _
IIf(IsStringBlank(Trim(Request.Form("txtImpDate").Replace("/",""))),"", _
FormatDateSubmit(Request.Form("txtImpDate")))
>>
>>
>>IsStringBlank() and FormatDateSubmit() are other functions in my class. The IsStringBlank() IS returning true, but the FormatDateSubmit() function is still being called even though it is in the "false" part of the IIf. Any ideas what I'm missing here?
>>
>>Thanks,
>>KP
>
>Kevin,
>
>That behavior is normal for IIf. You have to use an If..Then with AndAlso or OrElse to get short-circuit evaluation.

Keith,
While it might be normal for VB it sounds to be a bug to me. In documentation it says it's a counterpart of "?" operator of C. ? operator's behavior is absolutely is not like that. Both C and VFP (iif()) correctly only call the relevant part.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform