out of curiosity

G

Guest

hey all,

i have the following 2 scenarios, 1 works the other doesn't:

this works:

If IsDBNull(e.Item.DataItem("DateField")) Then
e.Item.Cells(DATE_APPROVED).Text = String.Empty
Else
e.Item.Cells(DATE_APPROVED).Text = "a value"
End If

this doesn't work (it appears to execute the false part when the function
actually returns true in the Command window.)

textbox1.text=iif(IsDBNull(e.Item.DataItem("DateField")), String.Empty,
"false part")


thanks,
rodchar
 
G

Guest

Be aware that IIf is a method and as such all arguments are evaluated when
you call this method - i.e., the true and false parts are always evaluated.
(this is in contrast to the behavior of the ternary or '?' operator in C#,
which is not a function).
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter
Clear VB: Cleans up outdated VB.NET code
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top