Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When is > not >

Status
Not open for further replies.

sn0rg

IS-IT--Management
Joined
Aug 5, 2005
Messages
95
Location
GB
I'm using a peice of code:
Code:
if intDNSServer > ubound(arrDNSSServers) then

When I echo out the values, they are both 0 (zero). Fine.

However, when I run this code, the "if" condition is found to be true when it clearly isn't.

If I change the "ubound(arrDNSServers)" code for "0" (zero), the condition is false, correctly.

Anyone know why this is happening?
 
An uninitialized arred may return -1 as UBound ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The array is initialised, and I can echo out the value as zero. Most odd...
 
I guess
[tt] wscript.echo vartype(intDNSServer) & vbcrlf & vartype(arrDNSServers)[/tt]
will give you enough clue.
 
OK. I have:

inDNSServer = 2
arrDNSServers = 8204

What does this mean?

A quick Google served only to confuse me further. 8204 means I have a collection of variants in the array?? There's only one entry in the array - declared as a Zero...
 
2 means vbInteger, hence, intDNSServer is an integer all right.
8204=vbArray+vbVariant=8192+12, hence, it is an array of variant.

So there would be no oddity there. ubound() should give you 0 for a single component array you mentioned you have.

I would say, the problem is somewhere else.
 
Err, well it would appear that the script required a weekend break. I was about to post the entire code and thought I would check it. When I ran it again it seems to be OK. The lab machines I was running it from were rebooted over the weekend, so maybe that was a factor somehow.

C'est la vie

Thanks for the pointers anyhow - always learning from you guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top