Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11928

Re: Variable type questions

From "Roger Roesler" <worm.composter@nospam.arcornews.de>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Variable type questions
Date 2018-04-29 19:54 +0200
Organization No Such Agency
Message-ID <fkmfa6F7spdU1@mid.individual.net> (permalink)
References <swdf41oi1p7r$.1s7t32djqg8xd.dlg@40tude.net> <fkli1dF1gifU1@mid.individual.net> <1u87muxsbkmpk.1znphd68dbaj$.dlg@40tude.net>

Show all headers | View raw


JJ <jj4public@vfemail.net> typed:

>> The result is somewhat unexpected. HTH
>
> You shouldn't apply bitwise operator on variable types because
> variable type values mostly are not bit masks (except vbArray).
>
> In that code, vbError is 10, and vbObject is 9. AND-ing them would
> result to 8, where if it's converted to boolean, it will be true.
> Because numbers which isn't zero, will always evaluate to true if
> it's converted to boolean.
>
> So, instead of:
>
>  CBool(VarType(Err) And vbError)
>
> It should be:
>
>  ((VarType(Err) And &HFFF) = vbError)

Ok, thanks!

-- 
ЯR

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Variable type questions JJ <jj4public@vfemail.net> - 2018-04-27 02:16 +0700
  Re: Variable type questions "Mayayana" <mayayana@invalid.nospam> - 2018-04-26 17:17 -0400
    Re: Variable type questions JJ <jj4public@vfemail.net> - 2018-04-28 02:44 +0700
  Re: Variable type questions "R.Wieser" <address@not.available> - 2018-04-27 09:38 +0200
    Re: Variable type questions JJ <jj4public@vfemail.net> - 2018-04-28 02:56 +0700
  Re: Variable type questions "Roger Roesler" <worm.composter@nospam.arcornews.de> - 2018-04-29 11:35 +0200
    Re: Variable type questions JJ <jj4public@vfemail.net> - 2018-04-29 22:51 +0700
      Re: Variable type questions "Roger Roesler" <worm.composter@nospam.arcornews.de> - 2018-04-29 19:54 +0200

csiph-web