Jscript Solution for Eval

  • Thread starter Thread starter Derek Hart
  • Start date Start date
D

Derek Hart

I have read several threads on using Jscript to simulate the Eval function:

using system
Class DynamicCode
{
function runcode(code : string)
}
}

Being a newbie to working between languages, can you tell me how to compile
this into my VB.Net app using Visual Studio.Net. I assume this needs to
become its own DLL. Then Intellisense should work to call this in VB.Net,
right?

Derek
 
I wish to execute code from a string. The string will have a function name,
which will return a string:

Dim a as string
a = "MyFunctionName(param1, param2)"

I have seen a ton of people discuss how reflection does this, but I cannot
find the syntax to do this. I have tried several code example off of
gotdotnet and other articles. Can somebody please show me the code to do
this?

Thank You,
Derek
 
In the viewpoint of syntax, .NET doesn't support do so. If you wanted to do
this, you might write your code to interpret the content of string and then
call some custom functions or method to do some work.

In other words, you can do it with your application instead of the direct
support from .net.

Regards,
Justin Wan
Microsoft Partner Online Support

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
::From: "Derek Hart" <[email protected]>
::References: <uwovCu#[email protected]>
<#SafEz#[email protected]>
::Subject: Re: Jscript Solution for Eval
::Date: Sun, 6 Jul 2003 11:48:59 -0700
::Lines: 33
::X-Priority: 3
::X-MSMail-Priority: Normal
::X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
::X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
::Message-ID: <eMWVE9#[email protected]>
::Newsgroups: microsoft.public.dotnet.framework.windowsforms
::NNTP-Posting-Host: lsanca1-ar3-4-60-038-089.lsanca1.dsl-verizon.net
4.60.38.89
::Path:
cpmsftngxa09.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
phx.gbl!TK2MSFTNGP10.phx.gbl
::Xref: cpmsftngxa09.phx.gbl
microsoft.public.dotnet.framework.windowsforms:8135
::X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
::
::I wish to execute code from a string. The string will have a function
name,
::which will return a string:
::
::Dim a as string
::a = "MyFunctionName(param1, param2)"
::
::I have seen a ton of people discuss how reflection does this, but I cannot
::find the syntax to do this. I have tried several code example off of
::gotdotnet and other articles. Can somebody please show me the code to do
::this?
::
::Thank You,
::Derek
::
::::> Hello,
::>
::> > I have read several threads on using Jscript to simulate
::> > the Eval function:
::>
::> AFAIK this works with JScript code only.
::>
::> Regards,
::> Herfried K. Wagner
::> --
::> MVP ?VB Classic, VB .NET
::> http://www.mvps.org/dotnet
::>
::>
::
::
::
 
Reflection is used for class libraries that need to understand a type's
definition in order to provide some rich functionality. Reflection doesn't
do the job as you mentioned...

Regards and thanks,
Justin Wan
Microsoft Partner Online Support

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
::From: "Derek Hart" <[email protected]>
::References: <uwovCu#[email protected]>
<#SafEz#[email protected]>
<eMWVE9#[email protected]>
<[email protected]>
::Subject: Re: Jscript Solution for Eval
::Date: Tue, 8 Jul 2003 09:17:34 -0700
::Lines: 86
::X-Priority: 3
::X-MSMail-Priority: Normal
::X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
::X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
::Message-ID: <#[email protected]>
::Newsgroups: microsoft.public.dotnet.framework.windowsforms
::NNTP-Posting-Host: lsanca1-ar3-4-60-038-089.lsanca1.dsl-verizon.net
4.60.38.89
::Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
::Xref: cpmsftngxa09.phx.gbl
microsoft.public.dotnet.framework.windowsforms:8289
::X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
::
::Look, this absolutely can be done with reflection. That is a fact.
Please
::don't give me answers like this that are wrong. Does anybody know the
::correct answer?
::
::Derek
::
::::> In the viewpoint of syntax, .NET doesn't support do so. If you wanted to
::do
::> this, you might write your code to interpret the content of string and
::then
::> call some custom functions or method to do some work.
::>
::> In other words, you can do it with your application instead of the
direct
::> support from .net.
::>
::> Regards,
::> Justin Wan
::> Microsoft Partner Online Support
::>
::> This posting is provided "AS IS" with no warranties, and confers no
::rights.
::> --------------------
::> ::From: "Derek Hart" <[email protected]>
::> ::References: <uwovCu#[email protected]>
::> <#SafEz#[email protected]>
::> ::Subject: Re: Jscript Solution for Eval
::> ::Date: Sun, 6 Jul 2003 11:48:59 -0700
::> ::Lines: 33
::> ::X-Priority: 3
::> ::X-MSMail-Priority: Normal
::> ::X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
::> ::X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
::> ::Message-ID: <eMWVE9#[email protected]>
::> ::Newsgroups: microsoft.public.dotnet.framework.windowsforms
::> ::NNTP-Posting-Host: lsanca1-ar3-4-60-038-089.lsanca1.dsl-verizon.net
::> 4.60.38.89
::> ::Path:
::>
::cpmsftngxa09.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP
08
::> phx.gbl!TK2MSFTNGP10.phx.gbl
::> ::Xref: cpmsftngxa09.phx.gbl
::> microsoft.public.dotnet.framework.windowsforms:8135
::> ::X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
::> ::
::> ::I wish to execute code from a string. The string will have a function
::> name,
::> ::which will return a string:
::> ::
::> ::Dim a as string
::> ::a = "MyFunctionName(param1, param2)"
::> ::
::> ::I have seen a ton of people discuss how reflection does this, but I
::cannot
::> ::find the syntax to do this. I have tried several code example off of
::> ::gotdotnet and other articles. Can somebody please show me the code to
::do
::> ::this?
::> ::
::> ::Thank You,
::> ::Derek
::> ::
::> ::::> ::> Hello,
::> ::>
::> ::> > I have read several threads on using Jscript to simulate
::> ::> > the Eval function:
::> ::>
::> ::> AFAIK this works with JScript code only.
::> ::>
::> ::> Regards,
::> ::> Herfried K. Wagner
::> ::> --
::> ::> MVP ?VB Classic, VB .NET
::> ::> http://www.mvps.org/dotnet
::> ::>
::> ::>
::> ::
::> ::
::> ::
::>
::
::
::
 
Back
Top