Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a button column on my datagrid view. Please advise how to show an image on that button?
Thanks
Posted
Updated 26-Feb-13 6:05am
v2
Comments
mosi98 26-Feb-13 7:20am    
use img tag in asp source and use eval or bind
for example
<itemtemplate>
<img src='<%# Eval("[fieldname]") %>' alt='<%# Eval("Alt_Txt") %>' />

Seeking for something like this: WinForm ImageButton[^]

OR want to do something like (not too sure but it would be something like below):
VB
Dim img As Image = Image.FromFile("someimage.png")
myButton.Image = img

' OR

myButton.Image = New Bitmap("Summers.jpg")
 
Share this answer
 
Comments
Furqan Sehgal 11-Mar-13 7:36am    
It says image is not a member of myButton
Sandeep Mewara 11-Mar-13 7:53am    
Check: button1.BackgroundImage = Image.FromFile(@"C:\my.jpg");
Sandeep Mewara 11-Mar-13 7:54am    
One more article: http://www.codeproject.com/Articles/9734/Custom-Bitmap-Button-Using-C
See the response from Kira Qian here: http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/eb9dee12-dbb9-42c8-bbe2-be8f17da044e[^]

You will most likely need to scale the image to the button size first.
 
Share this answer
 

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