Basic elements of Visual Basic .NET syntax

When creating BPM processes, it is possible to use VB language syntax. For instance, initial values can be assigned to parameters in such way or operations on numbers or texts inside processes can be performed.

Operators

Visual Basic supports the following types of operators:

Operation NameVB.NETC#T-SQL
A less than B A < BA < BA < B
A less than or equal to BA <= BA <= BA <= B
A equal to BA = B A == B A = B
A greater than BA > BA > BA > B
A greater or equal to BA >= BA >= BA >= B
A different from BA <> BA != BA <> B
A or BA OrElse BA | | BA OR B
A and BA AndAlso BA & & BA AND B
Assigning decimal value 10,1 to AA = 10.1DA = 10.1m A = 10.1
Assigning floating-point value
10,1 to A
A = 10.1RA = 10.1A = 10.1
Negation of ANot A!A-
Combining strings”a” & b.ToString()”a” + b.ToString()‘a’ + b
The first element of T tableT(0)T [0]-
Creating an object of nullable integer typeNew Nullable(Of Int32)New Nullable()-
Invoking a method with SalesInvoice generic typeObjectFactory.Create(Of SalesInvoice)()ObjectFactory. Create()-
Converting an object object into type TypeDirectCast(object, Type)

CType(object, Type)
(Type)Object-
Null valueNothingnullNULL
A is not a nullA IsNot NothingA !=nullA IS NOT NULL
A is a nullA is NothingA == M
A is of Type typeTypeOF A Is TypeA Is Type-
Creating a directory of String types key and Decimal values and initiating it with”KOS” key of value 2.0DNew Dictionary(Of String, Decimal)() From {{"KOS", 2.0D}}new Dictionary() {{"KOS", 2.0m}}-
Creating an object of DocumentEventParams type and initiating its property DocumentId with value 169New DocumentEventParams() With {.DocumentId = 169}new DocumentEventParams() {DocumentId = 169}-
Assigning a text value: Text to variable AA ="Text"A ="Text"SET @A = 'Text'
Assigning a text value in inverted commas: “Text” to variable AA ="""Text"""A ="\"Text\""SET @A = '"Text"'
Using a conditional operator to assign a text value to a variable of string type A on the basis of the value B (if B equals to Nothing, A will equal to String.Empty, otherwise, A will equal to B)A = If(B Is Nothing, String.Empty, B)A = B == null ? String.Empty : B-
Creating an anonymous methodIEnumerable.Find(Function(c) c.Code.Equals("PL"))IEnumerable.Find(c => c.Code == "PL")
Note
It is necessary to remember about correct types when comparing. For example, expression “73” <“9” returns True, because the first character in the first expression is classified higher than in the other one. If first characters are equal, then the next character from both expressions is compared, etc.

Intellisense mechanism

Comarch ERP Standard BPM has its own Intellisense mechanism. Intellisense is a form of automatic completion. At the same time, it is designed for documenting and disambiguating names of variables, functions and methods. Using the mechanism is a convenient way to get access to descriprions of functions, and partially to the list of their parameters.

Intellisense mechanism

 

Czy ten artykuł był pomocny?