Solved

Macro substitucion in visual basic 2012

Posted on 2014-03-22
6
279 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
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 250 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 45

Accepted Solution

by:
aikimark earned 250 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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