Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Name expresions not working with WITH..ENDWITH
Message
From
23/10/2000 16:54:26
 
 
To
23/10/2000 15:27:56
Jorge Haro
Independent Consultant
Juarez, Mexico
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00433086
Message ID:
00433194
Views:
15
>That works!, thanks a lot Nick, have any idea why my code didn't?, is it an issue with With ... EndWith?, is it by design?, or is what am doing just conceptually wrong?, just for the sake of knowledge.
>

WITH takes an object reference, not a name. IOW:

WITH EVAL(lcObjectName)

resolves to an object reference; name resolution, OTOH, does not resolve the variable to an object, even if it might be treating the content as the name of a thing rather than as a literal.

>>Jorge, try instead:
>>
>>WITH EVAL(lcObjectName)
>>
>>
>>>I'm having trouble with the following code:
>>>
>>>
>>>with (lcObjectName)
>>>    .IncreaseUsageCounter()
>>>    .visible = .t.
>>>endwith
>>>
>>>lcObjectName contains the name of an object, but I'm getting a data type mismatch, I know the object exists, and I can see it and it's properties in the debugger, I've also tried it with "thisform" as the value for lcObjectName just for testing, and I get the same error.
>>>
>>>It works using macro substituion, but I'm doing this inside a do while loop and AFIK macro substitutions are only evaluated once in this circumstances so it's not an option.
>>>
>>>basically this:
>>>
>>> with (oObject)
>>>
>>>and this:
>>>
>>> with oObject
>>>
>>>behave the same way, as if the parentheses had no effect whatsoever.
>>>
>>>TIA
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform