I have yet another variable going missing problem that I'd like to
understand how it happens.

In the click method for a button I have code like:

lcinstruct = ' '

do form B p1, p2, p3 to lcinstruct

if empty(lcinstruct)
messagebox("error happened")
endif

occasionally the empty(lcinstruct) will fail with "Function argument
value, type, or count is invalid." due, I believe to the variable
lcinstruct disappearing.

In my error handler I do a list memory and in the list of variables
lcinstruct does not appear in instances where the crash occurs however
it does appear in other instances where I force a List memory to happen.

The Unload routine of form B has a return lcinstruct statement.


thanks

pete

Re: Vanishing variable by Rush

Rush
Sun Mar 16 23:54:21 CDT 2008

Peter Huish wrote:
> I have yet another variable going missing problem that I'd like to
> understand how it happens.
>
> In the click method for a button I have code like:
>
> lcinstruct = ' '
>
> do form B p1, p2, p3 to lcinstruct
>
> if empty(lcinstruct)
> messagebox("error happened")
> endif
>
> occasionally the empty(lcinstruct) will fail with "Function argument
> value, type, or count is invalid." due, I believe to the variable
> lcinstruct disappearing.
>
> In my error handler I do a list memory and in the list of variables
> lcinstruct does not appear in instances where the crash occurs however
> it does appear in other instances where I force a List memory to happen.
>
> The Unload routine of form B has a return lcinstruct statement.
>
>
> thanks
>
> pete
>
"lcInstruct" would imply a local, character variable. But did you
declare it as LOCAL? Because otherwise, it's private by default, and is
visible to called procedures. I don't know if this is germane, but it
is the first thing I'd check.

- Rush

Re: Vanishing variable by Peter

Peter
Mon Mar 17 01:03:10 CDT 2008



> "lcInstruct" would imply a local, character variable. But did you
> declare it as LOCAL? Because otherwise, it's private by default, and is
> visible to called procedures.

There is no specific definition statement. Seemingly it is disappearing
within the same method.



Re: Vanishing variable by Man-wai

Man-wai
Mon Mar 17 01:51:14 CDT 2008

> In the click method for a button I have code like:
> lcinstruct = ' '
> do form B p1, p2, p3 to lcinstruct
> if empty(lcinstruct)
> messagebox("error happened")
> endif
> occasionally the empty(lcinstruct) will fail with "Function argument
> value, type, or count is invalid." due, I believe to the variable
> lcinstruct disappearing.

1. local lcInstruct
2. do formB *with* p1,p2,p3 to lcInstruct
3. Does formB.unload() returns a value?
4. Is formB using a variable with the name "lcInstruct", including
the parameter list in formB.init()?
5. Any public lcInstruct?

--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04) Linux 2.6.24.3
^ ^ 14:47:01 up 2 days 1:35 3 users load average: 1.55 1.34 1.29
? ? (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa/

Re: Vanishing variable by Cathy

Cathy
Mon Mar 17 08:33:37 CDT 2008

Have you set it to ANYTHING in the method. If you haven't declared it in any
way, and you haven't explicitly set it to anything, you probably aren't
returning what you thought you were returnning. You initialized the variable
before calling the form .. but that value is not passed into the form. Using
the TO clause accepts a return value from the form .. it does not send the
value in to the form.


"Peter Huish" <huish@ozemail.com.au> wrote in message
news:MPG.2248b5e0e44683299896e9@news.easynews.com...
>
>
>> "lcInstruct" would imply a local, character variable. But did you
>> declare it as LOCAL? Because otherwise, it's private by default, and is
>> visible to called procedures.
>
> There is no specific definition statement. Seemingly it is disappearing
> within the same method.
>
>


Re: Vanishing variable by Peter

Peter
Mon Mar 17 21:31:25 CDT 2008


> Have you set it to ANYTHING in the method. If you haven't declared it in any
> way, and you haven't explicitly set it to anything, you probably aren't
> returning what you thought you were returnning. You initialized the variable
> before calling the form .. but that value is not passed into the form. Using
> the TO clause accepts a return value from the form .. it does not send the
> value in to the form.

The variable is explicitly set as follows:

lcnewinstruct = ''

What I am trying to understand is how in 95% of the cases the code works
fine but there is seemingly this other case where the variable vanishes.


thanks,

Re: Vanishing variable by rk

rk
Tue Mar 18 07:33:20 CDT 2008

On Mar 17, 10:31=A0pm, Peter Huish <hu...@ozemail.com.au> wrote:
> > Have you set it to ANYTHING in the method. If you haven't declared it in=
any
> > way, and you haven't explicitly set it to anything, you probably aren't
> > returning what you thought you were returnning. You initialized the vari=
able
> > before calling the form .. but that value is not passed into the form. U=
sing
> > the TO clause accepts a return value from the form .. it does not send t=
he
> > value in to the form.
>
> The variable is explicitly set as follows:
>
> lcnewinstruct =3D ''
>
> What I am trying to understand is how in 95% of the cases the code works
> fine but there is seemingly this other case where the variable vanishes.
>
> thanks,

Do you have a "return .F." or something similar in your init event of
your form? From microsoft help - "If the form Init event procedure
returns .F., preventing the form from being instantiated, the Unload
event procedure will not return a value to VarName." I would think
that this could be your problem.

Re: Vanishing variable by Lew

Lew
Wed Mar 19 22:18:48 CDT 2008

It doesn't matter what you name the variable in the return statement, it's a
different variable with a different scope. Giving it the same name just
confuses the issue. Try a statement in the unload like return 5. Work
backwards from there.

"Peter Huish" <huish@ozemail.com.au> wrote in message
news:MPG.2248a18b5ac5909d9896e8@news.easynews.com...
>
> I have yet another variable going missing problem that I'd like to
> understand how it happens.
>
> In the click method for a button I have code like:
>
> lcinstruct = ' '
>
> do form B p1, p2, p3 to lcinstruct
>
> if empty(lcinstruct)
> messagebox("error happened")
> endif
>
> occasionally the empty(lcinstruct) will fail with "Function argument
> value, type, or count is invalid." due, I believe to the variable
> lcinstruct disappearing.
>
> In my error handler I do a list memory and in the list of variables
> lcinstruct does not appear in instances where the crash occurs however
> it does appear in other instances where I force a List memory to happen.
>
> The Unload routine of form B has a return lcinstruct statement.
>
>
> thanks
>
> pete



Re: Vanishing variable by Jeff

Jeff
Thu Mar 20 08:22:56 CDT 2008

If you really think that the variable is vanishing you can confirm your
suspicion with a DISPLAY MEMORY TO PRINT or DISPLAY MEMORY TO FILE
<filename>. This should give you the information that you need to see what
is going on if for some reason, you can't use the debugger.

"Peter Huish" <huish@ozemail.com.au> wrote in message
news:MPG.2249b09a60c3bee29896ea@news.easynews.com...
>
>> Have you set it to ANYTHING in the method. If you haven't declared it in
>> any
>> way, and you haven't explicitly set it to anything, you probably aren't
>> returning what you thought you were returnning. You initialized the
>> variable
>> before calling the form .. but that value is not passed into the form.
>> Using
>> the TO clause accepts a return value from the form .. it does not send
>> the
>> value in to the form.
>
> The variable is explicitly set as follows:
>
> lcnewinstruct = ''
>
> What I am trying to understand is how in 95% of the cases the code works
> fine but there is seemingly this other case where the variable vanishes.
>
>
> thanks,



Re: Vanishing variable by Dan

Dan
Thu Mar 20 10:55:38 CDT 2008

If you really want to see *where* the variable is disappearing, set a
breakpoint on Type("theVar")="U" in the debugger.

Dan

Jeff Grippe wrote:
> If you really think that the variable is vanishing you can confirm
> your suspicion with a DISPLAY MEMORY TO PRINT or DISPLAY MEMORY TO
> FILE <filename>. This should give you the information that you need
> to see what is going on if for some reason, you can't use the
> debugger.
> "Peter Huish" <huish@ozemail.com.au> wrote in message
> news:MPG.2249b09a60c3bee29896ea@news.easynews.com...
>>
>>> Have you set it to ANYTHING in the method. If you haven't declared
>>> it in any
>>> way, and you haven't explicitly set it to anything, you probably
>>> aren't returning what you thought you were returnning. You
>>> initialized the variable
>>> before calling the form .. but that value is not passed into the
>>> form. Using
>>> the TO clause accepts a return value from the form .. it does not
>>> send the
>>> value in to the form.
>>
>> The variable is explicitly set as follows:
>>
>> lcnewinstruct = ''
>>
>> What I am trying to understand is how in 95% of the cases the code
>> works fine but there is seemingly this other case where the variable
>> vanishes. thanks,