请帮助:动态声明 [英] Please Help: dynamic statement

查看:53
本文介绍了请帮助:动态声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,希望有人能告诉你是否有办法动态,建立一个声明,然后调用一些

函数来执行该语句。我知道例子总是

帮助,所以这就是我要完成的事情:


将myStatement作为字符串调整

myStatement =" ;昏暗的结果为整数结果= 2 * 3"


现在有什么方法可以让程序将
myStatement视为一个判断并因此执行什么

vb代码在里面?


期待收到您的回复。 TANX

Hi everyone, hope someone can tell if there is any way to,
dynamically, build an statement and then call some
functions to execute the statement. I know examples always
help, so here what I am trying to accomplish:

Dim myStatement as String
myStatement = "Dim result as integer result= 2 * 3"

now is there any way to actually let a program to treat
myStatement as a statment and therefore execute whatever
vb code is in it?

Looking forward to hearing from you. TANX

推荐答案

" A Jafarpour" <我们******* @ sympatico.ca> schrieb
"A Jafarpour" <we*******@sympatico.ca> schrieb
大家好,希望有人能分辨出是否有任何方法,动态地构建语句,然后调用一些
函数来执行语句。我知道这些例子总是很有帮助,所以这就是我要完成的事情:

将myStatement变为字符串
myStatement =" Dim result as integer result = 2 * 3"

现在有没有办法真正让程序将myStatement视为一个语句,从而执行其中的vb代码?
Hi everyone, hope someone can tell if there is any way to,
dynamically, build an statement and then call some
functions to execute the statement. I know examples always
help, so here what I am trying to accomplish:

Dim myStatement as String
myStatement = "Dim result as integer result= 2 * 3"

now is there any way to actually let a program to treat
myStatement as a statment and therefore execute whatever
vb code is in it?




字符串本身无法执行。申请必须满足一些最低

的要求才能编制。


您可以查看CodeDom:

< a rel =nofollowhref =http://msdn.microsoft.com/library/en-us/cpguide/html/cpcongeneratingcompilingsourcecodedynamicallyinmultiplelanguages.asptarget =_ blank> http://msdn.microsoft.com/library /en...elanguages.asp

-

Armin

http://learn.to/quote



The string itself can not be executed. An application must meet some minimum
requirements in order to be compilable.

You might have a look at CodeDom:

http://msdn.microsoft.com/library/en...elanguages.asp
--
Armin

http://learn.to/quote


嗨Armin,


我认为你误解了他的问题 - 他只是想在一个文本框中输入一个字符串

,然后执行该字符串就像它是一个

宏,不像是一个可执行程序。我怀疑你或Herfried

确实知道如何做到这一点;我不想,但我也很想知道。


Bernie Yaeger


" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道

news:%2 **************** @ TK2MSFTNGP11.phx.gbl ...
Hi Armin,

I think you misunderstood his question - he simply wants to enter a string
into a textbox, for example, and then execute the string as if it were a
macro, not as if it were an executable program. I suspect you or Herfried
do know how to do this; I don''t but I''d love to know also.

Bernie Yaeger

"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
" Jafarpour <我们******* @ sympatico.ca> schrieb
"A Jafarpour" <we*******@sympatico.ca> schrieb
大家好,希望有人能分辨出是否有任何方法,动态地构建语句,然后调用一些
函数来执行语句。我知道这些例子总是很有帮助,所以这就是我要完成的事情:

将myStatement变为字符串
myStatement =" Dim result as integer result = 2 * 3"

现在有没有办法真正让一个程序将myStatement视为一个语句,从而执行其中的vb代码?
字符串本身不能被执行。应用程序必须满足一些
Hi everyone, hope someone can tell if there is any way to,
dynamically, build an statement and then call some
functions to execute the statement. I know examples always
help, so here what I am trying to accomplish:

Dim myStatement as String
myStatement = "Dim result as integer result= 2 * 3"

now is there any way to actually let a program to treat
myStatement as a statment and therefore execute whatever
vb code is in it?
The string itself can not be executed. An application must meet some



最低要求才能编译。

您可以查看CodeDom:

< a rel =nofollowhref =http://msdn.microsoft.com/library/en-us/cpguide/html/cpcongeneratingcompilingsourcecodedynamicallyinmultiplelanguages.asptarget =_ blank> http://msdn.microsoft.com/library /en...elanguages.asp

Armin

http://learn.to/quote



" Bernie Yaeger" <是***** @ cherwellinc.com> schrieb
"Bernie Yaeger" <be*****@cherwellinc.com> schrieb
我认为你误解了他的问题 - 例如,他只是想在文本框中输入一个
字符串,然后执行该字符串,好像它是一个宏,不是它是一个可执行程序。
I think you misunderstood his question - he simply wants to enter a
string into a textbox, for example, and then execute the string as if
it were a macro, not as if it were an executable program.




我知道他想要执行输入的行。 可执行程序与可执行程序的区别在哪里?由于他想要执行该行,我认为这是一个要执行的短程序。

-

Armin <

http://learn.to/quote



I understood he wants to execute the entered line. Where is the difference
to an "executable program"? As he wants to execute the line, I think it is a
kind of a short program to be executed.
--
Armin

http://learn.to/quote


这篇关于请帮助:动态声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆