?
Solved

Macro substitucion in visual basic 2012

Posted on 2014-03-22
6
Medium Priority
?
282 Views
Last Modified: 2014-04-03
Hello Experts,
is there any equivalent to visual fox macro substitution in visual basic 2012 ?
Regards,
0
Comment
Question by:rguillermo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 39

Expert Comment

by:nutsch
ID: 39947788
Describe what that substitution does and I can try telling you if I know how to do it in vb.
0
 

Author Comment

by:rguillermo
ID: 39948130
Hi Nutsch,
macro substitucion means using the content of a variable as part of the code at execution time:
Example 1

a = "b"
&a = 10

suposing "&" sign is the macrosubstitution indicator.
Then at execution time &a will be replaced by the content of a
resulting in
b = 10 as the code executed.

Example 2
dim aa(2,2)
aa(1,1) = "w_cod"
aa(1,2) = "3543"
aa(2,1) = "w_nam"
aa(2,1) = "William"

for a = 1 to 2
  x = aa(a,1)
  &x = aa(a,2)
next a

Code executed in the loop will be
w_cod = "3543"
w_nam = "William"

Thanks !
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 1000 total points
ID: 39949541
From what I read here:

    http://msdn.microsoft.com/en-us/library/4eabtddy(v=vs.80).aspx

...the closest thing would be the String.Format method.
0
 
LVL 46

Accepted Solution

by:
aikimark earned 1000 total points
ID: 39965680
Instantiate a scripting.control object and put your 'macro' statements and use the results.  You can use the EVAL() function in this environment.

There is the possibility of creating a .Net program on-the-fly and have it compiled and executed.  I've never done this, but I think it is possible.
0
 

Author Closing Comment

by:rguillermo
ID: 39975862
Thank you very much!!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

771 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