all groups > dotnet windows forms > june 2007 >
You're in the

dotnet windows forms

group:

Dynamically set button text in DataGridView


Dynamically set button text in DataGridView Curt Gough
6/28/2007 1:43:04 PM
dotnet windows forms:
I have a DataGridView with a DataGridViewButtonColumn that I want to use to
enable and disable records in the grid. When the button is clicked I have
code to change the value in a field called 'Enabled' from True to False, or
from False to True.

I can set the Text property of the button through the GUI. But what I really
want is to set the property in code during the CellFormatting event so that
the button reads 'Enable' when the record is disabled, or 'Disable' when the
record is enabled. I currently set the backcolor property for 'Disabled'
records in that event. How can I change the button text at the same time?

--
Curt Gough
123cgough@kcumb.edu

Remove 123 from above address to mail directly

Re: Dynamically set button text in DataGridView Richard Lewis Haggard
7/5/2007 5:08:29 PM
In short, you get the cell and set its Value to the desired string.
--
Richard Lewis Haggard
General: www.Haggard-And-Associates.com
Please come visit here for a couple thousand good giggles!:
www.haggard-and-associates.com/Humor/humor.htm

[quoted text, click to view]

AddThis Social Bookmark Button