CreateCodeBlock: IMetabaseCodeBlock;
CreateCodeBlock(): Prognoz.Platform.Interop.Metabase.IMetabaseCodeBlock;
The CreateCodeBlock method returns an object that contains a code on Fore.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
Mb: IMetabase;
Block: IMetabaseCodeBlock;
a: Array;
v: Variant;
Begin
Mb := MetabaseClass.Active;
Block := Mb.CreateCodeBlock;
Block.References := "MathFin";
Block.Text := "Sub M;" + #10 +
"Begin" + #10 +
" Debug.WriteLine(Math.Round(100.959, 2).ToString);" + #10 +
"End Sub M;" ;
If Block.Valid Then
v := Block.Execute("M", a);
Else
Debug.WriteLine(Block.ErrorMessage + ". string " + Block.Line.ToString + ". position " + Block.Position.ToString);
End If;
Dispose Block;
End Sub UserProc;
After executing the example the Block variable contains the object that is a code block on Fore.
See also: