473,383 Members | 1,716 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,383 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 4200
* "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,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.