C # - Additional information: Out of memory

0

Good afternoon,  I have the following error in my solution I do not know how to solve thank you to who can give me a hand.

privatevoidbtnSeleciona_Click(objectsender,EventArgse){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 occurring on the following line:

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

Thank you

    
asked by anonymous 01.10.2017 / 22:58

0 answers