Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ScriptControl Reset method

252 views
Skip to first unread message

Christopher MacKenzie

unread,
Jan 24, 2000, 3:00:00 AM1/24/00
to
It seems that the ScriptControl's Reset() method doesn't quite work. After
calling the Reset() method I call AddCode() with some code that was
previously added before the Reset() and the control throws and exception
with a "redefinition" error. What I would like to do is allow a user to
make changes to code that is already added to the control and since there is
no RemoveCode() method, I am attempting to do it via Reset() and AddCode().
Any help would be appreciated.

Thanks,
Christopher

Michael Harris

unread,
Jan 24, 2000, 3:00:00 AM1/24/00
to
I tried to duplicate this with a WSH hosted script as the host for the control but didn't get any error after the reset.
 
set sc = createobject("msscriptcontrol.scriptcontrol")
sc.language = "vbscript"
sc.addcode "sub hello():echo ""hello"":end sub"
sc.addobject "ws",wscript,true
sc.state = 1
sc.codeobject.hello
sc.reset
sc.addcode "sub hello():echo ws.scriptfullname :end sub"
sc.addobject "ws",wscript,true
sc.state = 1
sc.codeobject.hello
 
Here's a link from an old post about problems with the language property after a reset when the control is hosted as a control on a form rather than as an automation server.
 
 
How do you host the control?  If as a control on a form, try hosting it via a global variable initialized in the form load event instead.  It's a shot in the dark, but the KB article establishes that is behaves differently depending on how it is hosted.
 
A full MSDN search on "script control" gave only 36 hits, none matching your problem.
 
HTH

--
Michael Harris
 

 
"Christopher MacKenzie" <ckmR...@marsweb.com> wrote in message news:##oLPYqZ$GA...@cppssbbsa02.microsoft.com...

Oleg Tarandevich

unread,
Jan 25, 2000, 3:00:00 AM1/25/00
to
Hi, Christopher!

You must manipulate with ScriptControl states (State property).

See help for additional information...


Regards

Oleg.

0 new messages