Image read error

1 Answer 10 Views
PictureBox
chaoyuan
Top achievements
Rank 1
chaoyuan asked on 23 Feb 2024, 04:58 AM
The reading path image displays an error, the program code is as follows:
private void button1_Click(object sender, EventArgs e)
{
    OpenFileDialog _file = new OpenFileDialog();
    _file.InitialDirectory = ".";
    _file.Filter = "JPG(*.JPG;*.JPEG);|";
    _file.ShowDialog();
    if (_file.FileName != string.Empty)
    {
        string ProfilePicturePathName = _file.FileName;

        // Telerik --->>>   "System.Xml.XmlException: 'There are invalid characters in the specified encoding"
        radPictureBox1.SvgImage = RadSvgImage.FromFile(ProfilePicturePathName);

        // windows is ok
        pictureBox1.Image= Image.FromFile(ProfilePicturePathName);
    }
}

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 23 Feb 2024, 11:52 AM

Hello, chaoyuan,

According to the provided code snippet, it seems that you filter the OpenFileDialog to show JPG image. However, you are trying to assign the image to the SvgImage property. SvgImage property is used to assign a vector images. Can you please specify which is the exact image format that you want to use. In case your image is a JPG format, not SVG you should use the Image property of RadPictureBox

I hope this helps. In case you have further difficulties please let me know. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PictureBox
Asked by
chaoyuan
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or