Cor
Thu May 08 10:38:06 CDT 2008
David,
Maybe easier, "Is" is testing a Type and "=" a value.
While "Is" nothing means in fact no object, because everything is inheriting
from object, this goes forever.
Therefore it is If dr.Items("whatever") Is DBNull.Value then the type
DBNull.Value is tested.
While If CInt(dr.Items("whatever")) = 0 then the value zero is tested.
Cor
"David Anton" <DavidAnton@discussions.microsoft.com> schreef in bericht
news:831E24ED-2CEF-45D2-805A-8DE01EA3CDDC@microsoft.com...
> That's quite correct - with one addition: to make things a little more
> confusing, "If s = Nothing" and "If s Is Nothing" both work for strings,
> with
> subtly different results...
> --
>
http://www.tangiblesoftwaresolutions.com
> C++ to C#
> C++ to VB
> C++ to Java
> Java to VB & C#
> Instant C#: convert VB to C#
> Instant VB: convert C# to VB
> Instant C++: VB, C#, or Java to C++/CLI
>
>
> "Armin Zingler" wrote:
>
>> "Jethro" <jethro_uk@hotmail.com> schrieb
>> > Hi guys, quick sanity check please.
>> >
>> > When TESTING for nothing, it's "if <expr> Is Nothing"
>> >
>> > when ASSIGNING, it's "<expr> = Nothing"
>> >
>> > correct ?
>> >
>> > so a line "If ThisValue = nothing" in some (inherited) code is a
>> > bug, plain & simple ?
>>
>> No, not a bug, but IMO an undesired feature. Nothing used with value
>> types is the "default value" of the value type, i.e. zero for Integers,
>> 1/1/0001 with Dates, etc.
>>
>> "If ThisValue = nothing" only works with values types (not with
>> reference types), so if ThisValue is an Integer, it is equal to "If
>> ThisValue = 0"
>>
>> ....But, what about putting the caret on the word Nothing and pressing
>> [F1]? ;-)
>>
>>
>> AZ
>>
>>