Something Strange

Something Strange

Anonymous
Not applicable
183 Views
2 Replies
Message 1 of 3

Something Strange

Anonymous
Not applicable
I have experienced a rather perplexing problem and I don't quite know what
to do about it. Sometimes the values of my VB variables change and/or
arrays disappear AFTER I create an AutoCAD entity, usually text. This
obviously causes my app to crash.

Has anyone else had this problem? What causes this phenomenon and what did
you do about it?

TIA

JR
0 Likes
184 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Hi JR,
I've made the mistake of passing a variable into a sub or function byREF
instead of byVAL.
Of course there are reasons for using either option but a variable that is
passed ByRef will change value if manipulated by the program, whereas a
variable that is passed ByVal is just a copy of the current value of
variable. If you don't specify then VB passes ByRef by default.
Could the code you use to create the AutoCAD entity have this kind of
effect?

If I'm on the right track then look up the ByRef and ByVal keywords in MSDN
help or online. They explain better than I do.
=Mark

wrote in message
news:FBD3E6CD3F05D934B5E185E54D720026@in.WebX.SaUCah8kaAW...
> I have experienced a rather perplexing problem and I don't quite know what
> to do about it. Sometimes the values of my VB variables change and/or
> arrays disappear AFTER I create an AutoCAD entity, usually text. This
> obviously causes my app to crash.
>
> Has anyone else had this problem? What causes this phenomenon and what
did
> you do about it?
>
> TIA
>
> JR
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hi,

No, my code does not have this problem. As you know arrays cannot be passed
by value to a function or sub. Usually what happens is that once the entity
is created the trouble manifests itself, variables change value, the array
is no longer there. I don't know if it makes any difference, but I am using
AutoCAD 2000 on Windows NT 4.0 Service pack 5.

JR

Mark Johnston wrote in message
<5C1A2C765359C4EAE68CAF269BB50A1D@in.WebX.SaUCah8kaAW>...
>Hi JR,
>I've made the mistake of passing a variable into a sub or function byREF
>instead of byVAL.
>Of course there are reasons for using either option but a variable that is
>passed ByRef will change value if manipulated by the program, whereas a
>variable that is passed ByVal is just a copy of the current value of
>variable. If you don't specify then VB passes ByRef by default.
>Could the code you use to create the AutoCAD entity have this kind of
>effect?
>
>If I'm on the right track then look up the ByRef and ByVal keywords in MSDN
>help or online. They explain better than I do.
>=Mark
>
> wrote in message
>news:FBD3E6CD3F05D934B5E185E54D720026@in.WebX.SaUCah8kaAW...
>> I have experienced a rather perplexing problem and I don't quite know
what
>> to do about it. Sometimes the values of my VB variables change and/or
>> arrays disappear AFTER I create an AutoCAD entity, usually text. This
>> obviously causes my app to crash.
>>
>> Has anyone else had this problem? What causes this phenomenon and what
>did
>> you do about it?
>>
>> TIA
>>
>> JR
>>
>
0 Likes