C# - Additional information: Out of memory

Asked

Viewed 51 times

0

Good afternoon, I am with the following error in my solution I do not know how to solve thanks to who can give me a hand.

inserir a descrição da imagem aqui

private void btnSeleciona_Click(object sender, EventArgs e)
    {            
        SelecionaOpenFileDialog.Title = "Selecione a foto";
        SelecionaOpenFileDialog.Multiselect = false;
        SelecionaOpenFileDialog.Filter = "GIF (*.gif)|*.gif|JPEG (*.jpg)|*.jpg";
        SelecionaOpenFileDialog.FilterIndex = 2;
        SelecionaOpenFileDialog.FileName = "";
        SelecionaOpenFileDialog.ShowDialog();
        txtNomeImagem.Text = SelecionaOpenFileDialog.FileName;            
        if (txtNomeImagem.Text != "")
        {                
            this.FotoPictureBox.Image = Image.FromFile(txtNomeImagem.Text);               
        }
        else FotoPictureBox.Image = null;
    }

the error is happening on the following line:

this.FotoPictureBox.Image = Image.FromFile(txtNomeImagem.Text);

Thank you

  • This error occurs mainly when the selected image format is not valid. You know which format to select?

  • Memory management problems vary a lot, do you know the size of the image you are trying to allocate? is 32 bits? What file format?

  • really was the format of the image now I managed to solve thanks to you who gave me the light haha a simple nonsense generates big problems... finally thank you guys for the help!

No answers

Browser other questions tagged

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