TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
senthil kumar
NA
5
0
displaying url image in picturebox .NET CF
Sep 17 2009 3:58 AM
hi,
I am trying to develop an application using C#.
The problem i am facing is i am unable to display an url image in picturebox.
each time i try , m_bmpdata = null.... i can retrieve the url image height, width etc but the pict is not displaying. below is the code i m trying. Any help or hint will be very helpful. I been trying for the past 2 days.
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(thumbnail.Url);
request.Timeout = 5000; // 5 seconds in milliseconds
request.ReadWriteTimeout = 20000; // allow up to 20 seconds to elapse
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream ms = response.GetResponseStream();
using (MemoryStream ms2 = new MemoryStream())
{
int bytes = 0;
byte[] temp = new byte[4096];
while ((bytes = ms.Read(temp, 0, temp.Length)) != 0)
ms2.Write(temp, 0, bytes);
test = new Bitmap(ms2);
//response.BinaryWrite(ms2.ToArray());
}
pictureBox2.Height = test.Height;
pictureBox2.Width = test.Width;
pictureBox2.Image = test;
thank you very much for any help... a big thanks in advance.. if there is any better do inform me... thank you thank you
Reply
Answers (
4
)
Threading C#
DateTime.Now returns bad time