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

Join 136,789 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,323 people online right now. Registration is fast and FREE... Join Now!




DataGridViewButtonCell

 
Reply to this topicStart new topic

DataGridViewButtonCell, How to effort variable button captions?

KrzychoE
3 Oct, 2008 - 02:35 AM
Post #1

New D.I.C Head
*

Joined: 3 Oct, 2008
Posts: 1


My Contributions
I want to have a DataGridView with one Button per row. Caption onbutton shall vary depending on other column value.
in colimn definition I wrote
UseColumnTextForButtonValue=false;

and after populating of DataTable binded to the grid I wrote such code:

CODE

                foreach (DataGridViewRow rw in TaxDataGridView.Rows)
                {
                    int cp;
                    cp=string.Compare(rw.Cells[0].Value.ToString(), "02");
                    DataGridViewButtonCell cel=(DataGridViewButtonCell)rw.Cells[6];
                    if (cp == 0)
                    {
                        cel.Value = "New payment";
                    }
                    else
                        cel.Value = " ";
                }


it's strict by MSDN instruction, but doesn't work - all buttons are blank.

Did anybody solved this problem?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 01:33PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month