Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid URI: The format of the URI could not be determined

Tags:

c#

wpf

When try to execute it give an error. in my stand alone application

hare is my code

var uri = new Uri(@"Earnest_Indieiduals/image/qty15section3.jpg");
                qestion15.Source = new BitmapImage(uri);

error Invalid URI: The format of the URI could not be determined.

enter image description here

like image 790
Datta Avatar asked Dec 08 '22 08:12

Datta


1 Answers

Use

var uri = new Uri(@"image/qty15section3.jpg", UriKind.Relative);

in case code you are trying to execute is written in assembly Earnest_Indieiduals.

Also you can use Pack URI's.

var uri = new Uri("pack://application:,,,/image/qty15section3.jpg",
                   UriKind.Absolute);
like image 113
Rohit Vats Avatar answered Dec 11 '22 07:12

Rohit Vats