PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • Including a .NET assembly in a WINDEV or WEBDEV project
  • Using elements of the .NET assembly
  • Limits
  • Using standard .NET Framework 4 assemblies (and below)
  • Using standard .NET Framework 4 assemblies (and below)
  • Using standard assemblies of .NET 5 SDK
  • Using a .NET assembly created with WINDEV
  • List of .Net assemblies used in the project
  • Reloading the .NET assemblies
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
The .NET technology is Microsoft's new development platform. This .NET platform simplifies the development of distributed-object applications whose modules communicate via Internet.
This help globally explains how to use the .NET technology in WINDEV, WINDEV Mobile and WEBDEV. For more details, see a specific documentation.
Including a .NET assembly in a WINDEV or WEBDEV project
To include .NET assemblies in the current application:
  1. On the "Project" tab, in the "Project" group, expand "Import" and select "A .NET assembly"
  2. Select the .NET assemblies that will be included in the current application. A "Search" area allows you to easily find the desired assembly. The "Browse" button allows you to select an assembly that is not displayed in the list. The assembly selected via the "Browse" button is automatically displayed at the beginning of the list and selected.
  3. Validate. The selected assemblies are imported.
Using a .NET assembly is equivalent to using a class in WLanguage.
Reminder: The classes are visible in the "Project explorer" pane. The .NET classes are grouped by "Namespace".

Using elements of the .NET assembly

The following elements imported into the .NET assembly can be handled in WLanguage:
  • Delegates: the delegates can be handled by DotNetDelegate.
    Versions 19 and later
    You also have the ability to add a delegate with the += operator:
    clDotNet is ClassEventManagement
    // Branch the event
    clDotNet:m_LogHandler += Proc_Test
    // ...
    // Triggers the event
    clDotNet:SendAMessage("String sent")
    //-------------------------------------------------
    // Manage the event
    PROCEDURE Proc_Test(src, args)
    Info("The string passed as parameter via the delegate is " + args:get_Message())
    New in version 19
    You also have the ability to add a delegate with the += operator:
    clDotNet is ClassEventManagement
    // Branch the event
    clDotNet:m_LogHandler += Proc_Test
    // ...
    // Triggers the event
    clDotNet:SendAMessage("String sent")
    //-------------------------------------------------
    // Manage the event
    PROCEDURE Proc_Test(src, args)
    Info("The string passed as parameter via the delegate is " + args:get_Message())
    You also have the ability to add a delegate with the += operator:
    clDotNet is ClassEventManagement
    // Branch the event
    clDotNet:m_LogHandler += Proc_Test
    // ...
    // Triggers the event
    clDotNet:SendAMessage("String sent")
    //-------------------------------------------------
    // Manage the event
    PROCEDURE Proc_Test(src, args)
    Info("The string passed as parameter via the delegate is " + args:get_Message())
  • NestedType with more than 1 level
  • Reference
  • Properties
  • Array with more than 1 dimension
  • Structures.
  • Enums.
    You have the ability to combine the Enum coming from .Net assemblies via &, | , ||, ~ . You have the ability to convert the enums into integers or to build them from integers.
  • Internal classes: the following syntax must be used:
    <Object name> is "<Class name>"

    The syntax without quotes is also available:
    <Object name> is <Class name>

    Example:
    O is "ExternalClass.InternalClass"

    O is ExternalClass.InternalClass
  • Versions 21 and later
    Generic:
    The following syntax is used to instantiate a generic:
    <Object name> is "<Generic name><<Concrete type>>"
    Example for instantiating a generic:
    MyList is "List<CMyObject>"
    New in version 21
    Generic:
    The following syntax is used to instantiate a generic:
    <Object name> is "<Generic name><<Concrete type>>"
    Example for instantiating a generic:
    MyList is "List<CMyObject>"
    Generic:
    The following syntax is used to instantiate a generic:
    <Object name> is "<Generic name><<Concrete type>>"
    Example for instantiating a generic:
    MyList is "List<CMyObject>"
  • Versions 21 and later
    Generic methods:
    The following syntax is used to call a generic method:
    <Object name>."<Name of generic method><<Concrete type>>"(<parameters>)
    Example for calling a generic method:
    // Prototype of the generic CloneList method of CClone class
    // CloneList(List<T>)
    // ...
    MyList is "List<int>"
    // ...
    clClone is CClone
    MyListCopy is "List<int>" <- clClone."CloneList<int>"(MyList)
    New in version 21
    Generic methods:
    The following syntax is used to call a generic method:
    <Object name>."<Name of generic method><<Concrete type>>"(<parameters>)
    Example for calling a generic method:
    // Prototype of the generic CloneList method of CClone class
    // CloneList(List<T>)
    // ...
    MyList is "List<int>"
    // ...
    clClone is CClone
    MyListCopy is "List<int>" <- clClone."CloneList<int>"(MyList)
    Generic methods:
    The following syntax is used to call a generic method:
    <Object name>."<Name of generic method><<Concrete type>>"(<parameters>)
    Example for calling a generic method:
    // Prototype of the generic CloneList method of CClone class
    // CloneList(List<T>)
    // ...
    MyList is "List<int>"
    // ...
    clClone is CClone
    MyListCopy is "List<int>" <- clClone."CloneList<int>"(MyList)
  • Extension methods:
    The extension methods can be called like the methods of the object.
When possible, the WLanguage types are implicitly converted into .Net types.
Example:
clDotNetString is "String" dynamic
sWLString is string = "string"
clDotNetString = sWLString

Limits

  • A WLanguage class cannot be derived from a .NET class.
  • The following types are supported:
    • Date/Time
    • WINDEV currencies. In output, the WINDEV currencies are converted into decimal numbers.
    • Decimal numbers
      A decimal parameter passed from a .NET assembly to a WLanguage function is converted into currency if possible. If this conversion is not possible, the parameter is converted into double.
    • Structures
  • The objects derived in .NET from an exported WLanguage class are not supported. If an object of this type is passed to a WLanguage function as parameter, it is "casted" into the base WLanguage type.
  • Passing pointer parameters between WLanguage and .NET is not supported.
  • The "structure" members found in classes and/or in sets are not visible in .NET because the WLanguage structures are not visible in .NET. To fix this problem, create a class containing the code of the structure.
  • The "class" members found in classes and/or in sets are visible in .NET only if the class is exported as well.
  • Caution: Components created with version 11 (or earlier) that use .NET will no longer work with version 27. It is necessary to generate the components again with version 27.
Using standard .NET Framework 4 assemblies (and below)

Using standard .NET Framework 4 assemblies (and below)

To use standard .NET Framework 4 assemblies (and below):
  1. Select the ".NET assemblies" folder in the "Project Explorer" pane.
  2. Open the context menu and select "Use a .NET assembly".
  3. In the window that appears, click "Automatically fill a list with the .NET assemblies on your disk. Caution: This process may take quite a long time.".
  4. Select the standard assemblies to use (mscorlib.dll or another assembly).
  5. Validate.
Versions 27 and later

Using standard assemblies of .NET 5 SDK

To use standard assemblies of .NET 5 SDK:
  1. Select the ".NET assemblies" folder in the "Project Explorer" pane.
  2. Open the context menu and select "Use a .NET assembly".
  3. In the window that appears, click "Select the .NET assemblies on disk....".
  4. Select the setup directory of the .NET 5 SDK. For example:
    "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0".
  5. Select the standard assemblies to use (System.Runtime.dll or another assembly).
    Caution, this directory contains the mscorlib.dll file. This file must not be selected if the .NET 5 SDK is used.
  6. Validate.
New in version 27

Using standard assemblies of .NET 5 SDK

To use standard assemblies of .NET 5 SDK:
  1. Select the ".NET assemblies" folder in the "Project Explorer" pane.
  2. Open the context menu and select "Use a .NET assembly".
  3. In the window that appears, click "Select the .NET assemblies on disk....".
  4. Select the setup directory of the .NET 5 SDK. For example:
    "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0".
  5. Select the standard assemblies to use (System.Runtime.dll or another assembly).
    Caution, this directory contains the mscorlib.dll file. This file must not be selected if the .NET 5 SDK is used.
  6. Validate.

Using standard assemblies of .NET 5 SDK

To use standard assemblies of .NET 5 SDK:
  1. Select the ".NET assemblies" folder in the "Project Explorer" pane.
  2. Open the context menu and select "Use a .NET assembly".
  3. In the window that appears, click "Select the .NET assemblies on disk....".
  4. Select the setup directory of the .NET 5 SDK. For example:
    "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0".
  5. Select the standard assemblies to use (System.Runtime.dll or another assembly).
    Caution, this directory contains the mscorlib.dll file. This file must not be selected if the .NET 5 SDK is used.
  6. Validate.
Using a .NET assembly created with WINDEV
The assemblies generated by WINDEV can be used like any other .NET assembly. However, the WINDEV framework and the assembly must be found in the same directory.
List of .Net assemblies used in the project
To display the list of .Net assemblies used in the project, you can:
  • On the "Project" tab, in the "Project" group, expand "List of elements" and select "List of .NET assemblies used".
  • In the "Project explorer" pane, select "List of .NET assemblies used in the project" in the context menu of ".NET assemblies".
Versions 20 and later
Reloading the .NET assemblies
You can reload the .NET assemblies used in the project to take into account a change made to an assembly since the project was opened.
  1. In the "Project explorer" pane, select ".NET assemblies".
  2. In the context menu of this element, select "Reload .NET assemblies".
New in version 20
Reloading the .NET assemblies
You can reload the .NET assemblies used in the project to take into account a change made to an assembly since the project was opened.
  1. In the "Project explorer" pane, select ".NET assemblies".
  2. In the context menu of this element, select "Reload .NET assemblies".
Reloading the .NET assemblies
You can reload the .NET assemblies used in the project to take into account a change made to an assembly since the project was opened.
  1. In the "Project explorer" pane, select ".NET assemblies".
  2. In the context menu of this element, select "Reload .NET assemblies".
Related Examples:
WD Text-To-Speech Training (WINDEV): WD Text-To-Speech
[ + ] This example explains how to perform a speech synthesis in a WINDEV application by using the SpeechSynthesizer class found in the .NET framework.
Note:
- This example requires .Net version 3.0 (or later),
- The speech synthesizer is available in English version by default.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment