Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 132,689 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,307 people online right now. Registration is fast and FREE... Join Now!




Datagridview Button, Image on Button

 
Reply to this topicStart new topic

Datagridview Button, Image on Button

ismailc
post 27 May, 2008 - 06:42 AM
Post #1


New D.I.C Head

*
Joined: 14 Sep, 2007
Posts: 33



Thanked 1 times
My Contributions


Hi,

I have a datagrid & want to display an image on button:

CODE

  private void dgvRegion_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex == 5)
            {
                e.Value = TCOST002.Properties.Resources.delete;
            }
        }


Please Assist

Regards
User is offlineProfile CardPM

Go to the top of the page

Jayman
post 27 May, 2008 - 08:14 AM
Post #2


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,839



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


What is the problem that you are having?
User is offlineProfile CardPM

Go to the top of the page

ismailc
post 27 May, 2008 - 11:28 PM
Post #3


New D.I.C Head

*
Joined: 14 Sep, 2007
Posts: 33



Thanked 1 times
My Contributions


QUOTE(jayman9 @ 27 May, 2008 - 09:14 AM) *

What is the problem that you are having?


Thank You for the assist.

I'm trying to add an inmage to a button on the grid.

I got an image on the grid but don't really want that.

GataGrid button, image on button

This code does not really work - the button display text "System.Drawing"
e.Value = TCOST002.Properties.Resources.delete;


Please Assist
User is offlineProfile CardPM

Go to the top of the page

Jayman
post 28 May, 2008 - 10:02 AM
Post #4


Student of Life

Group Icon
Joined: 26 Dec, 2005
Posts: 6,839



Thanked 38 times

Dream Kudos: 500

Expert In: C#, VB.NET, Java

My Contributions


The DataGridViewButton control doesn't have a property to set an image.

You will need to use a DataGridViewImageColumn to display images. Just use the DataGridView.CellClick event to handle when the image is clicked.
User is offlineProfile CardPM

Go to the top of the page

ismailc
post 28 May, 2008 - 10:38 PM
Post #5


New D.I.C Head

*
Joined: 14 Sep, 2007
Posts: 33



Thanked 1 times
My Contributions


Hi,

I do have something that, but my manager does not like that he wants a button - so now i have a button which looks horrible on a grid.

No code to add image on a datagrid button.


Regards
User is offlineProfile CardPM

Go to the top of the page

rgfirefly24
post 29 May, 2008 - 03:30 AM
Post #6


D.I.C Regular

Group Icon
Joined: 7 Apr, 2008
Posts: 330



Thanked 5 times

Dream Kudos: 150
My Contributions


QUOTE(ismailc @ 28 May, 2008 - 11:38 PM) *

Hi,

I do have something that, but my manager does not like that he wants a button - so now i have a button which looks horrible on a grid.

No code to add image on a datagrid button.


Regards


well if you wanted to create your own custome Datagridbutton you could include support for images. Wouldn't be too excruciatingly hard to do since it would extend Button
User is offlineProfile CardPM

Go to the top of the page

ismailc
post 29 May, 2008 - 03:42 AM
Post #7


New D.I.C Head

*
Joined: 14 Sep, 2007
Posts: 33



Thanked 1 times
My Contributions


Hi, i'm at entry level

Please assist with steps & code

all i know is - grid - edit columns & add button.

Please Assist!

Regards
User is offlineProfile CardPM

Go to the top of the page

rgfirefly24
post 29 May, 2008 - 01:30 PM
Post #8


D.I.C Regular

Group Icon
Joined: 7 Apr, 2008
Posts: 330



Thanked 5 times

Dream Kudos: 150
My Contributions


QUOTE(ismailc @ 29 May, 2008 - 04:42 AM) *

Hi, i'm at entry level

Please assist with steps & code

all i know is - grid - edit columns & add button.

Please Assist!

Regards



i should first ask is this an asp.net webapp or is it a windows app?
User is offlineProfile CardPM

Go to the top of the page

ismailc
post 29 May, 2008 - 10:29 PM
Post #9


New D.I.C Head

*
Joined: 14 Sep, 2007
Posts: 33



Thanked 1 times
My Contributions


Hi,

It is an windows application.

Regards
User is offlineProfile CardPM

Go to the top of the page

rgfirefly24
post 30 May, 2008 - 07:08 AM
Post #10


D.I.C Regular

Group Icon
Joined: 7 Apr, 2008
Posts: 330



Thanked 5 times

Dream Kudos: 150
My Contributions


QUOTE(ismailc @ 29 May, 2008 - 11:29 PM) *

Hi,

It is an windows application.

Regards



hrm, i'm not exactly sure how to create customer controls for windows applications. I'm a .NET developer so everything i do is asp.net with C# code behind. See if you can google for custom windows control.

search for custom windows control in C#

try the above link which is a google search.

This post has been edited by rgfirefly24: 30 May, 2008 - 07:10 AM
User is offlineProfile CardPM

Go to the top of the page

ismailc
post 2 Jun, 2008 - 11:40 PM
Post #11


New D.I.C Head

*
Joined: 14 Sep, 2007
Posts: 33



Thanked 1 times
My Contributions


Thank You very much - i posted on the site.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 07:33AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month