ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing and using .NET assemblies
  • Overview
  • How to?
  • Use example for a .Net assembly
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
C#: Calling a WLanguage procedure
Overview
A global procedure in WLanguage can be directly called from the code of a global procedure in C#.
How to?
To call a WLanguage procedure from the code of a global procedure in C#:
  1. Type the code of the WLanguage procedure. The WLanguage procedure must comply with some rules:
    • Have an acceptable name in C#.
    • The parameters of the WLanguage procedure and the return value must be of a supported type: Boolean, integer, real, string, buffer. It is recommended to pass parameters by value using the "LOCAL" keyword.
    • The extension attribute "C#" must be added to the WLanguage procedure.
    Example:
    PROCEDURE nWL_AddOne(LOCAL n is int), C#: int
    RETURN n+1
  2. Then, you can simply call the procedure from the C# code.
    For example:
    int nCSharp_ResultInt(int i)
    {
    return nWL_AddOne(i);
    }
Use example for a .Net assembly
A global procedure in C# can call assembly functions by using using:
For example:
  • Global procedure displaying a "YesNo" message:
    using System.Windows.Forms;

    public static bool pTEST(string _sMessage, string _sTitle)
    {

    DialogResult result;

    result = MessageBox.Show (_sMessage, _sTitle, MessageBoxButtons.YesNo,
    MessageBoxIcon.Question);

    return  (result == System.Windows.Forms.DialogResult.Yes);

    }
  • Call to the procedure from WLanguage (click code of a button or other):
    bRes = pTEST("This is my message", "My configured title")
    
    Info("YesNo in C# returned" + (bRes? "Yes" ELSE "No"))
See also
Minimum version required
  • Version 23
Comments
Click [Add] to post a comment

Last update: 09/26/2024

Send a report | Local help