Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

VB2005 execute string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerzy Zielinski - 23 Jul 2007 22:06 GMT
Hi all,

I would like to execute/evaluate a string that contains a VB script,
for example:
Dim s as string = "Dim avar as integer = 1"
' Evaluate s...
so s can be executed during runtime and avar will be created as a
result.

Thanks.
Jerzy
jerzy.zielinski@gmail.com
Cowboy (Gregory A. Beamer) - 23 Jul 2007 22:26 GMT
Reflection gives you the ability to emit code and run it. There is no direct
equivalent of the java (or JavaScript) eval function, but you can wrap the
attempt in an exception handler.

There is probably another way to play this game.

Signature

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************

> Hi all,
>
[quoted text clipped - 8 lines]
> Jerzy
> jerzy.zielinski@gmail.com
Jerzy Zielinski - 24 Jul 2007 02:56 GMT
Thank you for this sugestion.

OK. If there is no "eval", like in java. Maybe there is a way to
iterate the variable names to generate them automaticly with different
prefixes or suffixes. Something like: var1, var2, var3, ... varn. or
to pass a prefix in a function, procedure, sub call prefix & canstant
name would give a name of a boxes or lables in a page; like st_box,
nd_box, rd_box so in function call there is function_name("st"), and
in function there is    variable&"_box".Text = "some text"

Thank you in advance
Jerzy

On Jul 23, 4:26 pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> wrote:
> Reflection gives you the ability to emit code and run it. There is no direct
> equivalent of the java (or JavaScript) eval function, but you can wrap the
[quoted text clipped - 24 lines]
>
> - Show quoted text -
Cowboy (Gregory A. Beamer) - 24 Jul 2007 06:03 GMT
If you want to dynamically put out controls, that is simple. Just set a
container control, like a panel, and add controls to it. You can get far
more complex if you use data bound controls, like a GridView, etc., and add
code to the row databinding event. This allows you to alter the output to
fit your shims. If you then want to grab values, you can iterate through the
controls collection when the page is posted back.

Am I getting close?

Signature

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************

> Thank you for this sugestion.
>
[quoted text clipped - 45 lines]
>>
>> - Show quoted text -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.