473,385 Members | 1,597 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,385 software developers and data experts.

Execute something stored in a variable

April 20, 2006

Hi All

Thank you every one for your help, I have now started to get the feel of
VB.Net 2005.

How can I execute something stored in a variable.

For example, I want to store:

UserControl1.Show() or
UserControl2.Show()

in a variable and then execute whatever is in that variable.

Thanks in advance.
Mike TI
Apr 20 '06 #1
2 1551
"Mike TI" <su*******@hotmail.com> schrieb:
How can I execute something stored in a variable.

For example, I want to store:

UserControl1.Show() or
UserControl2.Show()

in a variable and then execute whatever is in that variable.


Dynamic compilation:

Build a Custom .NET "EVAL" Provider
<URL:http://www.eggheadcafe.com/articles/20030908.asp>

Runtime Compilation (A .NET eval statement)
<URL:http://www.codeproject.com/dotnet/evaluator.asp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Apr 20 '06 #2
April 22, 2006

Thank you for your reply. I found the example very difficult to understand
as I am very new to VB.Net.

Incidently, I read about the System.CodeDom namespace in MSDN, however I am
unable to get the example given to work. Does this do what I have in mind ?

*****
Dim start As New CodeEntryPointMethod()
Dim cs1 As New CodeMethodInvokeExpression( _
New CodeTypeReferenceExpression("System.Console"), _
"WriteLine", _
New CodePrimitiveExpression("Hello World!") )
start.Statements.Add(cs1)
*****

Please assist
Mike Ti

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
"Mike TI" <su*******@hotmail.com> schrieb:
How can I execute something stored in a variable.

For example, I want to store:

UserControl1.Show() or
UserControl2.Show()

in a variable and then execute whatever is in that variable.


Dynamic compilation:

Build a Custom .NET "EVAL" Provider
<URL:http://www.eggheadcafe.com/articles/20030908.asp>

Runtime Compilation (A .NET eval statement)
<URL:http://www.codeproject.com/dotnet/evaluator.asp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 22 '06 #3

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

Similar topics

1
by: PJ | last post by:
<% Set Conn = Server.CreateObject("ADODB.Connection") Conn.open application("dtat_motor_connectionstring") set rs = new adodb.recordset 'Set RS = Conn.Execute(' "exec spcn_update_transactions &...
2
by: Matt | last post by:
I want to exexute stored procedure in ASP, but it has error "Microsoft VBScript compilation (0x800A0401) Expected end of statement" on line (1). The stored procedure "sp_emp" contain "select *...
4
by: MD | last post by:
I am trying to create a dynamic SQL statement to create a view. I have a stored procedure, which based on the parameters passed calls different stored procedures. Each of this sub stored procedure...
2
by: Noloader | last post by:
Hello, Access XP, SQL Server 2000 Is it possible to hide a SP under Queries in Access, yet still be able to Execute it from Access? (Similar to hiding Tables, then using Views) We hooked...
4
by: Mike TI | last post by:
April 22, 2006 Hi all I want to execute a command stored in a variable, eg I may store: Form1.Show() or Form2.Show()
4
by: Dikkuuhh | last post by:
Hi, i have a function that can execute stored procedures, but i don`t know how i can give it back to the other classes. I did it in an ArrayList now, but how can i do it better, i can`t make it...
12
by: sukeshchand | last post by:
I want to exicute a Query that stored in a variable. and the Query is used to get a given value to a variable. I tried to use exec command but that returns an error. i cant get an idea for how to do...
2
by: hisham123 | last post by:
hi, I Wrote one stored procedure in which i declare one variable as Table then i stored in that table type variable select * from emp so now my table contain one sql statement by 4 rows...
3
by: Rahul Babbar | last post by:
Hi, I have the following doubt. Suppose I use the execute immediate statement and the statement to be executed is a Select statement from the sysibm.sysdummy1 table which will always return...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.