Re: Redundency of IsNull(Trim(myvar)) ?

From: Bob Butler (tiredofit_at_nospam.com)
Date: 05/20/04


Date: Thu, 20 May 2004 13:11:34 -0700


"Andy" <Andrzej7@hotmail.com> wrote in message
news:fd7401c43ea5$6d80f3b0$a101280a@phx.gbl
> I think
>
> Trim(myVariable) where myVariable is NULL
> will give you an error - Invalid use of Null or something
> because you can not Trim NULL.

Trim(Null) is fine and will return Null; the function takes a variant
argument and handles null values

Trim$(Null) is an error; the function takes a string argument and does not
accept null values

>> I am wondering if the following two statements always yield the same
>> results:
>>
>> 1) If IsNull(Trim(myVariable)) Then [...]
>>
>> 2) If IsNull(myVariable) Then [...]

My guess is that the original code should have been
  If Len(Trim(myvariable))=0 Then

in which case the Trim would be important to have

-- 
Reply to the group so all can participate
VB.Net... just say "No"


Relevant Pages

  • Re: More people whose website should be better.
    ... "Tim Berners-Lee confirmed as plenary speaker" ... Invalid. ... They haven't heard the conference speakers telling them why it ought to ... Andy Mabbett ...
    (uk.net.web.authoring)
  • Significance of log entries
    ... Subject: Significance of log entries ... peer died: Invalid argument ... Answer will determine if IP should be stuffed in my *.deny files. ... Andy ...
    (Focus-SUN)
  • Asynchronous Sockets
    ... which throws an error of "An invalid argument ... Can anyone tell me the stupid mistake I'm obviously making? ... The error happens on the line BeginAccept. ... Andy D ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: More Retired Generals Call for Rumsfelds Resignation
    ... the ability to "trim the incompetent" without ... Andy in Eureka, Texas ...
    (soc.retirement)
  • Invalid attempt to read when no data is present
    ... I am getting the error "Invalid attempt to read when no data is present" ... I have checked the sql and it is returning ... SqlDataReader dtrEmail = cmdGetEmail.ExecuteReader; ... Andy ...
    (microsoft.public.dotnet.framework.aspnet)