Add two values and show the result inside a label in c#?

Asked

Viewed 188 times

0

    {
        int valor7, valor8;

        valor7 = Convert.ToInt32(txtMoeda7.Text);
        valor8 = Convert.ToInt32(txtMoeda8.Text);


        resultado1 = valor7 + valor8 

        lblResultado1.Text = resultado1.ToString();
    }

inserir a descrição da imagem aqui

  • What’s the matter?

  • I tried this code but nothing appears on the label and when I click on the label the program hangs, I would be grateful if some experienced programmer can help me.

  • Hard to play local error post error too

  • You need to treat txtMoeda7.Text and txtMoeda8.Text. To not pass null values .. if(String.Isnullorempty(txtMoeda7.Text)){ valor7= 0}

  • Thanks Danielle Arruda Torres, your code tip solved my problem.

No answers

Browser other questions tagged

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