Click here to Skip to main content
16,015,296 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
openFileDialog1.CheckFileExists = true;
           openFileDialog1.CheckPathExists = true;
           openFileDialog1.DefaultExt = ".jpg";
           openFileDialog1.Filter = "jpg files (*.jpg)|*.jpg| PNG files (*.png)|*.png";
           openFileDialog1.FilterIndex = 2;
           openFileDialog1.RestoreDirectory = true;
           if (openFileDialog1.ShowDialog() == true)
           {
               string location = @"D:\images.txt";
               string path = System.IO.Path.Combine(location, picUserimage.Source + ".jpg");
               picUserimage.Source = new BitmapImage(new Uri(location));
           }


What I have tried:

string text = @"file:\\\D:\images.png";
                       text = text.Replace(@"file:\\\", @"");
                       string userimagepath = AppDomain.CurrentDomain.BaseDirectory + text + ds.Tables[0].Rows[0][11].ToString();
                       if (!File.Exists(userimagepath))
                       {
                           picUserimage.Source = BitmapFromUri(new Uri(text));
                       }
                       txtActivationKey.Text = ds.Tables[0].Rows[0][12].ToString();
                       txtCreatedby.Text = ds.Tables[0].Rows[0][13].ToString();
                       txtDate.Text = ds.Tables[0].Rows[0][14].ToString();
                       conn.Close();
Posted
Updated 17-Sep-22 2:35am

1 solution

Start by checking the path: is there a folder called "images.txt" in the root of your D: drive? Or is it (as seems more likely) a file?

If it's a folder, check the access permissions, and the account under which the app is being executed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900