Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 DataGridView
Good day all!!!
 
I have two columns "IsTrue" and "IsTrueImage" in my DataGridView. "IsTrueImage" is a image column.
 
I want to set the image for the individual image cells based on the whether or not the cell value for "IsTrue" is true or false.
 
I'm not sure how to go about this. CellFormatting, RowPrePaint, RowPostPaint.
 

Thanx in advance...
Posted 13-Feb-13 21:31pm
azinyama1.1K
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
hope you might be talking about DataTemplateSelector please follow the below link. or let me know if am wrong.
 
http://msdn.microsoft.com/en-us/library/system.windows.controls.datatemplateselector(v=VS.85).aspx[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

_AKA_KSN_: I understand you like to write posts; what I don't understand is your answer to azinyama.
 
- When did he mention DataTemplateSelector?
 
"You hope he might be talking it" ??? Did you even _read_ the question? Why would he be talking about it, if he doesn't write about it?
 
people like you really strengthen the myth: Random Internet people just dont care.
 
However; and back to answering OP.
 
It seems that using the cellformatting event, might be the way to go.
 
Here's a few threads about it, Azin.
 
http://johnroach.info/2012/01/13/how-to-add-images-to-datagridview-cell-using-c-and-windows-forms/
 
http://www.visualwebgui.com/Developers/Community/Projects/ApplicationVEM/Forums/tabid/179/forumid/29/postid/7169/scope/posts/Default.aspx
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 293
1 Sergey Alexandrovich Kryukov 281
2 RyanDev 65
3 nv3 60
4 Mehdi Gholam 45
0 Sergey Alexandrovich Kryukov 6,696
1 OriginalGriff 6,149
2 CPallini 2,473
3 Richard MacCutchan 1,697
4 Abhinav S 1,560


Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 2 Jan 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100