Hi All, We have come across a very strange bug between UniDynArray and VB6.
In our applications we were getting two different results on an if statement between the IDE and the compiled (into Native) exe. In the IDE case the statement was returning True which is correct. In the compiled native exe the exact same statement was returning false which is wrong as the statement should evaluate to true. If we compiled the exe into p-code then the statement evaluates to True as it should. The conditional statement seems to have to be in this exact structure (kind of like a perfect storm of conditions). ((var1.Field(1).StringValue > "") Or (False And Val(var1.Field(2).StringValue) > 0)) It must compare the same UniDynArray in each part of the if statement and perform a Val on the second UniDynArray. The issue can be demonstrated by the sample code below. We have two Booleans (b1 and b2) that should always evaluate to true. In the VB6 IDE b1 is true and b2 is true as expected. In the Compile Native exe b1 actually evaluates to false. (This is wrong b1 and b2 should always be True). --------------------------------------------------------------------------------------------------------------- Dim var1 As UniDynArray Dim b1 As Boolean Dim b2 As Boolean Set var1 = New UniDynArray var1.Field(1).StringValue = "1" var1.Field(2).StringValue = "" ' b1 and b2 should always be True ' When compiled into Native Code b1 is false and b2 is true. Why? b1 = ((var1.Field(1).StringValue > "") Or (False And Val(var1.Field(2).StringValue) > 0)) b2 = ((False And Val(var1.Field(2).StringValue) > 0) Or (var1.Field(1).StringValue > "")) MsgBox "b1=" & b1 & " and b2=" & b2 --------------------------------------------------------------------------------------------------------------- I know we can fix the problem quickly by swapping round the conditional blocks or create new variables to hold the string values and then compare them. My concern is that in our very large application what conditional statements could be failing in the executable we send out. Regards Adrian Halid Senior Analyst/Programmer IT Vision Australia Pty Ltd (ABN: 34 309 336 904) PO Box 881, Canning Bridge WA 6153 Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153 P: (08) 9315 7000 F: (08) 9315 7088 E: adrian.ha...@itvision.com.au<mailto:adrian.ha...@itvision.com.au> W: http://www.itvision.com.au<http://www.itvision.com.au/> ___________________________________________________________ NOTICE : This e-mail and any attachments are intended for the addressee(s) only and may contain confidential or privileged material. Any unauthorised review, use, alteration, disclosure or distribution of this e-mail (including any attachments) by an unintended recipient is prohibited. If you are not the intended recipient please contact the sender as soon as possible by return e-mail and then delete both messages. ___________________________________________________________ _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users