Click here to Skip to main content
15,887,945 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

How to add Picture into DataGridView through C#

Need to load image from remote location

My Code:

DataGridViewImageColumn img = new DataGridViewImageColumn();
Image image = Image.FromFile("localhost:8050/messsenger_resources/profile_pictures/girlrequest.png");
img.Image = image;
friend_request_grid.Columns.Add(img);

But getting unsupported url error.
Posted
Comments
Sergey Alexandrovich Kryukov 30-Aug-15 12:47pm    
What's wrong with reading original MSDN documentation?
—SA

Please see:
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewimagecell%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewimagecolumn(v=vs.110).aspx[^].

This way, you can have a separate System.Windows.Forms.DataGridViewImageCell cell or the whole column of such cells. Do the further reading by yourself.

Isn't it enough?

—SA
 
Share this answer
 
Comments
Abhinav S 30-Aug-15 14:33pm    
5!
Sergey Alexandrovich Kryukov 30-Aug-15 15:29pm    
Thank you, Abhinav.
—SA
 
Share this answer
 
Comments
Eswar1988 31-Aug-15 12:20pm    
Hi,

Thanks for your responses. I need to load image from my remote server not from local.

Example : image in http://xyz.com/images/img.jpg

How to load image from remote location in datagridview

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