Scripts and .NET Framework > Working with the Code Editor
  
Working with the Code Editor
You can write code in either standard VB.Net or CSharp. You can also switch between the two. If you change your language selection in the code editor, the system automatically converts existing code to the selected language.
If you need references to your own assemblies, you can use Run > Build > References.
As a fully compliant .NET application, you can find free source code to use, including .NET components, products, and libraries, plus your own libraries that you can use right away.
FactoryStudio does expose many .NET libraries to the application, but there are few methods that are very frequently required, such as type conversion or copying tags to DataTables or .NET objects, or dynamically changing the communication settings. Those methods are included in a library toolkit. To use those methods, you just need to put TK. in the code editor.
Example:
double x = TK.ConvertTo<double>("123");
The methods available are described in Toolkits.html.
To edit code:
1. Go to Edit > Scripts > CodeEditor.
2. From the drop-down list in the main toolbar, select the task or class you want to edit.
To create a new task or class, see Configuring Tasks or Configuring Classes.
3. If needed, from the code editor toolbar, select a different code language.
4. You can also format your code to be more readable, to do so, click on Auto Format. A prompt will appear, click “OK”
5. Click Save.