Initial Flow Code
Flow projects can be created in C# or Visual Basic. You will be prompted to select the language when you first create the project. Note that the language you select cannot be changed for the project after initialisation.
Designs in Visual Basic or C# contain a number of initial statements to simplify the referencing of common classes and their methods and properties. The following sections outline the initial code available for VB and C# Flow projects.
Visual Basic
When you create a Visual Basic form in Flow, the initial code available for use in your design is as follows:
Visual Basic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Public Class MainForm
Private Sub MainForm_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
A number of System libraries (Namespaces) are initially available for the design. These are the most often used for common requirements. Other namespaces are compatible with Flow designs and can also be utilised, but will need to be entered in the code or added with the designer.
Information on the namespaces provided in the initial code is contained in Namespaces.
C#
When you create a C# form in Flow, the initial code available for use in your design is as follows:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Flow
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
}
}
The initial namespaces available are the same as for Visual Basic with C# as the language - e.g. using in place of Imports.
A number of System libraries (Namespaces) are initially available for the design. These are the most often used for common requirements. Other namespaces are compatible with Flow designs and can also be utilised, but will need to be entered in the code or added with the designer.
Note: It is possible to have many Flow forms in design mode at once, however because some of the internal resources are shared, if you see a red syntax error underscore under the Namespace in the Code pane, simply change the Namespace from ‘Flow’ to a unique name. This will allow running in debug mode, as well as scripting assistance to be displayed.
Information on the namespaces provided in the initial code is contained in Namespaces.
Namespaces
The following table contains information on each of the namespaces available in the initial Visual Basic and C# Flow forms, as well as a link to Microsoft® Documentation for further details.
Namespace |
Description |
Microsoft® Documentation |
---|---|---|
System |
The System namespace contains classes that define commonly-used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions. |
|
System.Collections.Generic |
The System.Collections.Generic namespace contains interfaces and classes that define generic collections, which allow users to create strongly typed collections that provide better type safety and performance than non-generic strongly typed collections. |
|
System.ComponentModel |
The System.ComponentModel namespace provides classes used to implement the run-time and design-time behaviour of components and controls. |
|
System.Data |
The System.Data namespace provides access to classes that represent the ADO.NET architecture. ADO.NET lets you build components that efficiently manage data from multiple data sources. |
|
System.Drawing |
The System.Drawing namespace provides access to GDI+ basic graphics functionality. |
|
System.Linq |
The System.Linq namespace provides classes and interfaces that support queries using Language-Integrated Query (LINQ). |
|
System.Text |
The System.Text namespace contains classes that represent ASCII and Unicode character encodings and other classes. |
|
System.Threading.Tasks |
The System.Threading.Tasks namespace provides types that simplify the work of writing code. The main types are Task which represents an asynchronous operation that can be waited on and cancelled, and Task<TResult>, which is a task that can return a value. |
|
System.Windows.Forms |
The System.Windows.Forms namespace contains classes that support interoperation of Windows Forms and WPF controls. |