February 26, 2019, 9:23am
I want to create function using with
vb.net code in invoke code activity.
But its give error, please any one help me.
Function FindMax(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
’ local variable declaration */
Dim result As Integer
If (num1 > num2) Then
result = num1
result = num2
FindMax = result
Dim a As Integer = 100
Dim b As Integer = 200
Dim res As Integer
res = FindMax(a, b)
Console.WriteLine("Max value is :", res)
February 26, 2019, 2:07pm
The UiPath documentation is quite brief in InvokeCode activity description
But I suppose you could not declare Module inside InvokeCode, maybe not even Function, just plain .NET code
February 26, 2019, 2:09pm
February 26, 2019, 9:15pm
As pointed out by others, there’s no need for a module or function statement, and the
Invoke Code activity supports neither. However, what you’re trying to do is already part of .NET - no need to reinvent the wheel:
March 15, 2019, 4:26pm
Hope you’re doing well. I think I had the same problem as yours and this is how I figured it out : using Lambda Expressions (please see example here
VB.NET Lambda Expressions - Dot Net Perls).
So, to make your FindMax function in UiPath I followed the following steps:
Create the variables in UiPath
Add the Invoke code activity in a Sequence and edit arguments to create a “bridge” with previously created variables
Create the Lambda Expression doing the job I want
That’s all folks!
You’ll find attached the working XAML file for this example
FindMax With Invoke Code.xaml (5.7 KB).
February 4, 2020, 7:53am
I am faceing the problem that use System.Drawing.Point type in the invoke code activity,but It will be occur errors , do you have solution?
Like the below post
Wondering if someone has seen this error. I’m using Invoke Code to convert a text file to pdf using Spire.PDF. Weird thing is it actually worked a few times and then started throwing this error.
If I’m reading this right, it seems to be an issue with fowarding RectangeF in System.Drawing 184.108.40.206 to version 220.127.116.11 but issues finding that.
System.Drawing is in the Imported Namespaces, I’ve tried reordering in xaml file, .net 4.8 is installed, not sure what else to try.
Here’s the erro…
I found the docs right now!
Importing New Namespaces From the Imports Panel Open the Imports panel.In the Enter or Select namespace field, start typing the namespace that interest you. Note that suggestions are provided while you type, in case you are not exactly sure what you...
But there is no System.Drawing.Point.My God
How can I do it?