>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