Use scripting in your Canvas screens to customize the logic governing screen design and control object functionality. Canvas supports both C# and VB.NET programming languages. The choice is yours, but use a single programming language within each screen. The script will compile the same, and the controls will provide the same functionality, so use the language you prefer.
By default, the Canvas application uses the C# script language. If you prefer to use VB.NET, select that option in the Backstage view when opening a new screen. You can select your preferred default script language in the Settings page, General section.
Note: Many outside resources are available, online and otherwise, to learn more about scripting and using specific programming languages.
By default, the Canvas script editor and script engine are disabled. To enable scripting for any screen (or object), perform one of the following. Once enabled, scripting support cannot be disabled.
The Screen pane contains three views, accessible with the tabs at the bottom of the pane: the Design view, the Script view and the Controls view. Work in the Script view to customize screens with script, validate script, and manage assembly references. The structure of the script view is color-coded to help you quickly identify read-only and writable portions.
Note: Use Ctrl+T to toggle between Design view and Script view in the Screen pane. If scripting is not yet enabled, click Enable scripting for this screen to open the Script view.
When a screen is saved in Canvas, any script assemblies are compiled into a uniquely named .dll file (using a GUID assigned to the screen) and the assembly is added to the .can file, so the script does not have to be recompiled every time the screen is run. When a screen is loaded in Canvas preview or Canvas View, the precompiled .dll is extracted to a temp directory and the script assembly is loaded from disk. This results in faster load times by removing the need to recompile script. The screen property Unique name (UniqueName) exposes this name. See Load time.
Canvas screen examples are available in two locations:
Be sure to browse through these files to familiarize yourself with how scripting is commonly added to object events.
This section describes various Canvas scripting techniques and includes the following topics: