Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hello all,,,
I have a little problem in programing wp7 with c# vs2010.
in my project, i want to load image from galery,
i am build code like in vs2008 for windows mobile method, but not work in windows phone 7.
here my code for windows mobile
Bitmap Newimg = new Bitmap(@"\My Documents\my pictures\spring.jpg");
pictureBox1.Image = Newimg;

i am use method above for WP7, but not work,
please tell me for load image in wp7 with vs2010 c#
thanks.
Posted
Comments
Christian Graus 7-Jul-11 21:54pm    
What does 'not working' mean ? Are you sure you have the path right, b/c if you do, there's no reason for this not to work.
bagus bujangga 7-Jul-11 23:35pm    
@Christian Graus:
Argument 1: cannot convert from 'string' to 'System.Uri'

The best overloaded method match for 'System.Windows.Media.Imaging.BitmapImage.BitmapImage(System.Uri)' has some invalid arguments

I thing in WP7 using different method. like URI, but i don't know :D
Tarun.K.S 8-Jul-11 5:48am    
I haven't worked on WP7, but to give a path to "BitmapImage", it goes something like this:
BitmapImage btm = new BitmapImage(new Uri(@"\My Documents\my pictures\spring.jpg", Urikind.Relative));
bagus bujangga 8-Jul-11 7:28am    
and than where it the true path of the picture folder? this path is for windows mobile, :"My Documents\my pictures\" i can't see name picture on picture galery, how to see the file name and path?
Sergey Alexandrovich Kryukov 13-Apr-13 22:14pm    
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership. And the fact you even self-accepted on formally is just outrageous, a sure way for a ban. I hope you won't do it after this warning.

Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

1 solution

Try this it may work
pictureBox1.Image = Image.FromImage(Newimg);
 
Share this answer
 
v2
Comments
Tarun.K.S 8-Jul-11 7:50am    
How about pictureBox1.Image = Image.FromFile(@"\My Documents\my pictures\spring.jpg");
:D
bagus bujangga 10-Jul-11 0:23am    
Not work on VS2010 for WP7,.

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