473,246 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

Is dynamic code execution possible?

Hello,

I want to execute piece of code, which was created/loaded dynamically.
JScript/VBScript have this possibility via eval() method. How can I do
something similar in VB.NET? If I can't, then what are the alternatives?

A little background for my problem. I need to implement an application which
enumerates some data. On each data item it calls external plug-ins/hooks. I
need to implement these hooks as simple as possible. Ultimate goal is .js or
..vbs file with function that user will write. However, I don't know how to
execute this function from VB.NET.

Thanks in advance
Alex
Nov 20 '05 #1
7 4195
* "Alex Blekhman" <tkfx.DONTSENDSPAM.@yahoo.com> scripsit:
I want to execute piece of code, which was created/loaded dynamically.
JScript/VBScript have this possibility via eval() method. How can I do
something similar in VB.NET? If I can't, then what are the alternatives?


Untested: Maybe you can use the script control (VB6 sample):

<http://www.thescarms.com/vbasic/Scripting.asp>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OI**************@TK2MSFTNGP09.phx.gbl...
* "Alex Blekhman" <tkfx.DONTSENDSPAM.@yahoo.com> scripsit:
I want to execute piece of code, which was created/loaded dynamically.
JScript/VBScript have this possibility via eval() method. How can I do
something similar in VB.NET? If I can't, then what are the alternatives?


Untested: Maybe you can use the script control (VB6 sample):

<http://www.thescarms.com/vbasic/Scripting.asp>


Thanks. It appears that Script Control is the way to do that.
Nov 20 '05 #3
On 2004-02-02, Alex Blekhman <tk***************@yahoo.com> wrote:
Hello,

I want to execute piece of code, which was created/loaded dynamically.
JScript/VBScript have this possibility via eval() method. How can I do
something similar in VB.NET? If I can't, then what are the alternatives?

A little background for my problem. I need to implement an application which
enumerates some data. On each data item it calls external plug-ins/hooks. I
need to implement these hooks as simple as possible. Ultimate goal is .js or
.vbs file with function that user will write. However, I don't know how to
execute this function from VB.NET.

Thanks in advance
Alex


Alex,

You may want to look at the System.Reflection and the
System.Reflection.Emit namespaces. These should let you load/create
code dynamically.

I'll look around a bit - it seems I found a good article on this not to
long ago.
--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
It is easier to write an incorrect program than understand a correct one.
Nov 20 '05 #4
"Tom Shelton" <to*@mtogden.com> wrote in message
news:#o**************@tk2msftngp13.phx.gbl...

You may want to look at the System.Reflection and the
System.Reflection.Emit namespaces. These should let you load/create
code dynamically.


Thanks for pointer. I looked at it. At this time it's really overkill for my
project. MS Script Control suits my needs completely. BTW, the more I look
at .NET the more I'm impressed. These guys created a heck of universe
there..
Nov 20 '05 #5
In article <uT**************@TK2MSFTNGP10.phx.gbl>, Alex Blekhman wrote:
"Tom Shelton" <to*@mtogden.com> wrote in message
news:#o**************@tk2msftngp13.phx.gbl...

You may want to look at the System.Reflection and the
System.Reflection.Emit namespaces. These should let you load/create
code dynamically.


Thanks for pointer. I looked at it. At this time it's really overkill for my
project. MS Script Control suits my needs completely. BTW, the more I look
at .NET the more I'm impressed. These guys created a heck of universe
there..


That's cool... I just wanted to point out that there is an alternative
:)

--
Tom Shelton [MVP]
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 1 Build 2600
System Up Time: 4 Days, 21 Hours, 38 Minutes, 45 Seconds
Nov 20 '05 #6
Alex,
In addition to the others comments, you can use the classes in
System.CodeDom.Compiler, System.CodeDom along with
Microsoft.VisualBasic.VBCodeProvider to dynamically compile & execute VB.NET
source.

This article explains how:

http://msdn.microsoft.com/msdnmag/is...9/CuttingEdge/

Hope this helps
Jay

"Alex Blekhman" <tkfx.DONTSENDSPAM.@yahoo.com> wrote in message
news:eW**************@tk2msftngp13.phx.gbl...
Hello,

I want to execute piece of code, which was created/loaded dynamically.
JScript/VBScript have this possibility via eval() method. How can I do
something similar in VB.NET? If I can't, then what are the alternatives?

A little background for my problem. I need to implement an application which enumerates some data. On each data item it calls external plug-ins/hooks. I need to implement these hooks as simple as possible. Ultimate goal is .js or .vbs file with function that user will write. However, I don't know how to
execute this function from VB.NET.

Thanks in advance
Alex

Nov 20 '05 #7
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl...
Alex,
In addition to the others comments, you can use the classes in
System.CodeDom.Compiler, System.CodeDom along with
Microsoft.VisualBasic.VBCodeProvider to dynamically compile & execute VB.NET source.

This article explains how:

http://msdn.microsoft.com/msdnmag/is...9/CuttingEdge/

Thanks!
Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ford Desperado | last post by:
there is an application which issues a lot of simple dynamic queries against an Oracle database. If CURSOR_SHARING is set to FORCE, Oracle treats dynamic queries as static ones, for instance...
3
by: JDPope | last post by:
I have a situation which I cannot get a good lead on how to resolve. One of the applications I support uses the Hibernate software to generate SQL. The app is JAVA with JDBC. In testing the users...
6
by: MattC | last post by:
Hi, I'm implementing a new Business Layer in one of our applications. I'm toying with the idea of placing all the Create, Read, Update and Delete SQL in the object in question and build a...
60
by: Peter Olcott | last post by:
I need to know how to get the solution mentioned below to work. The solution is from gbayles Jan 29 2001, 12:50 pm, link is provided below: >...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
14
by: romayankin | last post by:
Hello All, I'm writing cross-platform code so i'm bound to standards. Here is the code I have: ~~~~~~~~~~~~~~~~~~ double **mx = new double*; for(int i = 0; i < col - 1; i++) { mx = new...
7
by: Ronald S. Cook | last post by:
I've always been taught that stored procedures are better than writing SQL in client code for a number of reasons: - runs faster as is compiled and lives on the database server - is the more...
15
by: EDBrian | last post by:
My problem is this. Our clients create different fields they want to collect and we allow them build dynamic filters, reports etc... We run some TSQL to actually create the column and all works...
10
by: Jonathan | last post by:
Hi all, I have a file consisting fixed width records from which I need to extract only those lines meeting certain conditions. These conditions do change and I find myself recoding/compiling...
6
by: =?ISO-8859-1?Q?Tim_B=FCthe?= | last post by:
Hi, we are building a Java webapplication using JSF, running on websphere, querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and PreparedStatements only (aka dynamic SQL). Every night,...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.