Error while converting null integer

Asked

Viewed 54 times

0

I’m making a conversion of a value int:

int.Parse(detalhe.GANO_ID_ATIV.ToString())

But you’re giving me a mistake

A cadeia de caracteres de entrada não estava em um formato correto.

What could be causing?

  • 1

    And what is the content of detalhe.GANO_ID_ATIV

  • is coming null...

  • @Arthurmoraes, apart from the answers of other questions. If in the case this property of the object have the possibility to come number or null, makes it interesting to use Convert.ToInt32(detalhe.GANO_ID_ATIV.ToString()), because he treats situations coming null returning as 0, soon the int.Parse he falls in exception in such cases. (Only a summary of what to use according to your programming rule)

  • no friend, kept giving the same error.... neither with int.Parse nor with Convert.Toint32

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.