Hi.
I implemented VB Script by using the MSScriptControl ActiveX component. Add
this as an ActiveX component reference.
You can add objects to the script control that will be accessible as global
variables in your script. The .NET Framework will automatically generate a
wrapper around you component that will allow the script to communicate with
it.
You can then add code. Call a function and get the return value.
There is however a problem with calling functions in the script that has
byref-arguments. You can get the value in, but not out. There is a solution
but it is pretty hard-core (it involves modyfing the automaticcaly generated
wrapper for the ActiveX component).
Please note, that it is possible to create scripts in VB.NET using the
Microsoft.Vsa namespace, but it is IMHO way too complex.
IScriptControl scriptControl;
scriptControl = new ScriptControlCl ass();
try
{
scriptControl.L anguage = "VBScript"; // could also be JScript.
// Add an object that is accessible from the script.
scriptControl.A ddObject("SomeO bject", someObject , false);
// Add some code to the script.
scriptControl.A ddCode( code );
// Execute a function
object returnValue = scriptControl.R un(functionName , arguments );
}
finally
{
// This is a COM Object so we should release it manually.
System.Runtime. InteropServices .Marshal.Releas eComObject(
scriptControl );
}
"Jim Heavey" <Ji*******@disc ussions.microso ft.com> wrote in message
news:B9******** *************** ***********@mic rosoft.com...
Hello, I am trying to figure out how to do some scripting.
Can I script in csharp?
Can I script in VBScript if my web page has been developed using csharp?
Can I iterate though a datatable object in my script file? How can I
reference the datatable object which was created in my code-behind form?
Thanks in advance for your assistance!!