User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 456,508 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,673 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 2476 | Replies: 6
Reply
Join Date: Aug 2006
Posts: 57
Reputation: Exelio is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Exelio Exelio is offline Offline
Junior Poster in Training

Question Help regarding images in datagridview

  #1  
Sep 24th, 2007
hi all,

i am trying to display a xml file in a datagridview.

i am using windows application with C#.

say for example, i have a xml file like this,

<xml version="1.0" encoding="UTF-8">
<maincategory>
<cat1>
<title>Category1</title>
<link>http://www.w3schools.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepi...tu90.jpg&quot; alt=&quot;some description</description>
</cat1>
<cat2>
<title>Category2</title>
<link>http://www.ibnlive.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepi...te90.jpg&quot;
some description</description>
</cat2>
</maincategory>

in the description i have a img tag containing a image from any site.
i have columns to display title,description.
i need to display the image along with the text in the same column description.

Adding an image column will display the image as a separate column. how can i display the image in the same column
along with the text?

Thanks in advance

Regards

Exelio
Last edited by Exelio : Sep 24th, 2007 at 10:38 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Location: Egypt
Posts: 763
Reputation: RamyMahrous is on a distinguished road 
Rep Power: 4
Solved Threads: 59
Featured Poster
RamyMahrous's Avatar
RamyMahrous RamyMahrous is offline Offline
Master Poster

Re: Help regarding images in datagridview

  #2  
Sep 24th, 2007
look you can make gridview cell to be a control, i.e PictureBox and then assign to this control the image path.
the scenario is, there is a base class you inherits from.
This was from MSDN but I am sorry I don't remember the link :s
B.Sc Computer Science, Helwan University
Microsoft Student Partner
Personal blog http://ramymahrous.blogspot.com/
Arabic technical blog http://fci-h-ar.blogspot.com/
English technical blog http://fci-h.blogspot.com/
Reply With Quote  
Join Date: Jun 2008
Posts: 1
Reputation: saritha07 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
saritha07 saritha07 is offline Offline
Newbie Poster

Re: Help regarding images in datagridview

  #3  
Jun 24th, 2008
Originally Posted by Exelio View Post
hi all,

i am trying to display a xml file in a datagridview.

i am using windows application with C#.

say for example, i have a xml file like this,

<xml version="1.0" encoding="UTF-8">
<maincategory>
<cat1>
<title>Category1</title>
<link>http://www.w3schools.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepi...tu90.jpg&quot; alt=&quot;some description</description>
</cat1>
<cat2>
<title>Category2</title>
<link>http://www.ibnlive.com</link>
<description>&lt;img src=&quot;http://static.ibnlive.com/pix/sitepi...te90.jpg&quot;
some description</description>
</cat2>
</maincategory>

in the description i have a img tag containing a image from any site.
i have columns to display title,description.
i need to display the image along with the text in the same column description.

Adding an image column will display the image as a separate column. how can i display the image in the same column
along with the text?

Thanks in advance

Regards

Exelio
how can display image in a gridview control
Reply With Quote  
Join Date: Nov 2006
Location: iran-tehran
Posts: 47
Reputation: mzd12111 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mzd12111 mzd12111 is offline Offline
Light Poster

Re: Help regarding images in datagridview

  #4  
Jul 11th, 2008
i have the same problem , for example on of the columns of the Data grid is for something that is proposed to show a picture , for example imagine a mailbox which the attachment column in that is "Checked" for mails with an attachment file and "Unchecked" for others , I've tried to bind an image with that column but it didn't work
Reply With Quote  
Join Date: Jul 2008
Posts: 89
Reputation: camilojvarona is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 9
camilojvarona camilojvarona is offline Offline
Junior Poster in Training

Re: Help regarding images in datagridview

  #5  
Jul 11th, 2008
My idea is to create a 'User Control' that will have to fields a 'Label' and a 'PictureBox' and it will expose both as pulbic properties so you can then intanciate the 'User Control', set the Label's property as the image description and the PictureBox's(PictureBox's Image property) property as the actual image and then add the new User Control to the DataGrid's Cell.

The same idea but a diferent approche that I like better(better encapsulation ) is
Instead of exposing the PictureBox in the User Control as a public poperty expose the PictureBox's ImageLocation property as a public property.

P.S- I am going to try it to see exactly how it works.

Thanks,
Camilo
Last edited by camilojvarona : Jul 11th, 2008 at 8:52 pm.
Reply With Quote  
Join Date: Jul 2008
Posts: 89
Reputation: camilojvarona is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 9
camilojvarona camilojvarona is offline Offline
Junior Poster in Training

Re: Help regarding images in datagridview

  #6  
Jul 11th, 2008
Hi,

My idea is to create a 'User Control' that will have to fields a 'Label' and a 'PictureBox' and it will expose both as pulbic properties so you can then intanciate the 'User Control', set the Label's property as the image description and the PictureBox's(PictureBox's Image property) property as the actual image and then add the new User Control to the DataGrid's Cell.

The same idea but a diferent approche that I like better(better encapsulation ) is
Instead of exposing the PictureBox in the User Control as a public poperty expose the PictureBox's ImageLocation property as a public property. And instead of expose the Label
expose the Label's Text property.

P.S- I am going to try it to see exactly how it works.

Thanks,
Camilo
Last edited by camilojvarona : Jul 11th, 2008 at 9:41 pm.
Reply With Quote  
Join Date: Jul 2008
Posts: 89
Reputation: camilojvarona is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 9
camilojvarona camilojvarona is offline Offline
Junior Poster in Training

Re: Help regarding images in datagridview

  #7  
Jul 12th, 2008
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C# Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C# Forum

All times are GMT -4. The time now is 3:47 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC