Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Executing a String from an Array

Posted on 1998-08-18
5
Medium Priority
?
144 Views
Last Modified: 2010-05-18
I have a series of strings in an array.  These strings are actually VB commands that I want to execute.  How can I tell VB to execute a certain index from an array?
0
Comment
Question by:IsleOfView
5 Comments
 
LVL 3

Expert Comment

by:SPECIALIST
ID: 1429611
It depends on what you want to do.  Give a specific example of what you want to do.  


Specialist

0
 

Author Comment

by:IsleOfView
ID: 1429612
Well, let's go from just the simplest example.
let's say that:

Array(0) = MsgBox "Hello World!"
Array(1) = MsgBox "Hello Again!"

Whatever--I would like to have these strings act as if they were a part of the module I am working in.  They should be able to call functions from other modules as well.

TIA
0
 
LVL 3

Expert Comment

by:Foyal
ID: 1429613
Sub AMessage(Index as Integer)
    Msgbox Array(Index)
End Sub
0
 

Author Comment

by:IsleOfView
ID: 1429614
Perhaps I'm not being clear--I don't know for sure that the array is going to contain, say, a msgbox command.  It might be something changing a property...The idea is to use the string contained in the array as a VB statement.
0
 
LVL 12

Accepted Solution

by:
mark2150 earned 200 total points
ID: 1429615
Umm, this idea can't work. VB is *COMPILED*, there is no way to dynamically interprit code at runtime. Your only option would be a *HUGE* task to write a VB emulator. There is just no concept of interpritted code in a compiled program.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question