Computing.Net > Forums > Programming > VB Commands (Simple Q)

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB Commands (Simple Q)

Reply to Message Icon

Name: concentriq
Date: November 5, 2002 at 14:53:11 Pacific
OS: WinXP
CPU/Ram: 550/512
Comment:

ok, rather simple question in VB.

suppose I have a string which I want to evaluate as a command, for example:


Dim str As String
str = "Command1.Enabled = True"
, now I want to have what is contained in str to run, and disable Command1

any help is appreciated...



Sponsored Link
Ads by Google

Response Number 1
Name: tru
Date: November 5, 2002 at 18:37:25 Pacific
Reply:

I'm not so sure there is a way to do this. Logically it wouldn't work because str occupies a space in memory. When the program is compiled and run that string goes into memory. At that point it is meaningless because it is source code and not machine code.


0

Response Number 2
Name: alai
Date: November 5, 2002 at 19:21:32 Pacific
Reply:

i dont have a book handy, by i think it is something like
eval(str)
anyone else?


0

Response Number 3
Name: Christian
Date: November 5, 2002 at 22:01:22 Pacific
Reply:

I think that is imposible in VB, if you read the theory. Itīs a compiled language, maybe you could do that with VBS, or other scripting languages.


0

Response Number 4
Name: Muslim
Date: November 7, 2002 at 09:29:54 Pacific
Reply:

Dim str As String
str = "Command1.Enabled = True"
, now I want to have what is contained in str to run, and disable Command1

Because str is the vb command u choose the other word replace the str and do not use ""
for example:
Dim a As String
a = Command1.Enabled = True


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


C ++ help C++ Arrays (Simple Q)



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB Commands (Simple Q)

simple vb commands www.computing.net/answers/programming/simple-vb-commands/531.html

VB EXE prog to launch a BAT and EXE www.computing.net/answers/programming/vb-exe-prog-to-launch-a-bat-and-exe/10949.html

Migration from VB to C www.computing.net/answers/programming/migration-from-vb-to-c/8407.html