Convert GenericValue to Int

Buen dia,

Alguno sabe como puedo convertir una variable (GenericValue) en Int ?

Tengo que capturar unos datos y determinar si son negativos o positivos pero al realizar la condicion los numeros que me salen con el signo menos me los toma como positivos, quisiera saber como convertir dicha variable en entero

1 Like

Hi

Usually we do this Convert.ToInt32(yourgenericvariable.ToString)

But when minus is added we won’t be able to convert that to a integer as it can to take symbols or special characters with it

To validate whether they are negative or positive value we can use a simple IF condition like this
yourvariable.ToString.Contains(“-“)

If true it goes to THEN or to ELSE

cheers @Mike99

1 Like

En ese caso como podria convertirlo o bueno como podria evaluar ese numero que toma la variable

1 Like

Para validar si son de valor negativo o positivo, podemos usar una condición IF simple como esta
yourvariable.ToString.Contains (“-“)

Cheers @Mike99

Gracias ya funciono

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.