Dynamically set button text in DataGridView

C

Curt Gough

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?
 
R

Richard Lewis Haggard

In short, you get the cell and set its Value to the desired string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top