How to sum "GenericValue"


I have to sum a variable of type “string” and another type “generic value” (which is the result of an ocr) and if I make the sum v1 + v2 with its original “type”, it does not do the sum, joins me together variables

i’m Try to convert the generic variable to Int32 but the next error appears.


Thanks for the help

@Braki, the same topic was recently discussed in forum (for multiplication),

You can convert the string and generic value to integer and sum as follows,
Integer total = CInt(string value) + Cint(Generic

Dominic :slight_smile:

1 Like

Hi @Braki,

Total= convert.ToInt32(BaseFinal)*Convert.ToInt32(Interest)

Change Generic value to string

Without convert to int also directly can use the generic value but some time if the value is empty/null it will through the error.

Always go to specific datatype for better performance.


When I try to perform the conversion I get the following error message:

With the next code:

Integer total = CInt(string value) -->conversion%201

With the next code:

Total = Convert.ToInt32(Interest)

(error of the overload resolution because none of the functions (toint32) that are accessed is more specific for these arguments:

Hey @Braki

Because you are passing Convert.ToInt32() a Generic data type variable.

Convert.ToInt32() - Converts the specified string representation of a number to an equivalent 32-bit signed integer.

So Use it like to avoid error in your workflow.

Int32 Total= convert.ToInt32(BaseFinal.ToString())*Convert.ToInt32(Interest.ToString())