#1
  1. No Profile Picture
    Resident Moron
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Location
    Tuscaloosa, AL
    Posts
    26
    Rep Power
    0

    JScript or VBScript in my C# Program?


    I've seen vague references in various books and things to being able to have a .NET Program use the JScript or VBScript interpreter to run their respective scripts.

    I'm writing a program that I'd like to enhance by allowing the users to do a bit of scripting, but I've not found any good references on the subject, and the Microsoft.JScript namespace has a whole lot of stuff in it.

    Anyone know if this is possible and, if so, where I can get more info on it?

    -Pete

    Comments on this post

    • JimmyGosling agrees
    Pete Holiday
    "The most overlooked advantage to owning a
    computer is that if they foul up, there's no law
    against whacking them around a little."

    More Quotes
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0
    The only thing i know about this is that you can regiter jscript scriptblocks and execute them on an event trigger

    String script = @"<script language=""Javascript"">your jscript function foo(){alert('foo');}</script>";

    Page.RegisterClientScriptBlock("name",script);

    now you can add this script as an attribute on a button
    btn.Attribute.Add("onClick","foo()");

    now it will execute onclick.

    i hope i did not tell you anything that you already knew.
    if so, sorry.
    else, hope it helped you

    you can find more in the msdn lib
    http://msdn.microsoft.com/library

    Comments on this post

    • JimmyGosling agrees
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0
    i forgot to add that this is only valid in a web app.

    i don't think jscript works in winforms apps..

    but then again... i'm no expert

IMN logo majestic logo threadwatch logo seochat tools logo