|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Programmatically checking a DataGridViewCheckboxCellI can't for the life of me figure out how to check or uncheck a cell
programmatically. I've looked in Lutz's reflector to see how the control is doing it and it calling an UpdateButtonState method that I don't have access to. This must be super simple but I'm just missing something. Any help would be GREATLY appreciated :) Hi,
If the DataGridView is data-bound just set the value in the associated property or column of your data source to "true". -- Show quoteDave Sexton "CJM" <cjmarq***@yahoo.com> wrote in message news:1159482979.135726.86310@m73g2000cwd.googlegroups.com... >I can't for the life of me figure out how to check or uncheck a cell > programmatically. I've looked in Lutz's reflector to see how the > control is doing it and it calling an UpdateButtonState method that I > don't have access to. > > This must be super simple but I'm just missing something. > > Any help would be GREATLY appreciated :) > On 2006-09-28, CJM <cjmarq***@yahoo.com> wrote:
> I can't for the life of me figure out how to check or uncheck a cell public Form1()> programmatically. I've looked in Lutz's reflector to see how the > control is doing it and it calling an UpdateButtonState method that I > don't have access to. > > This must be super simple but I'm just missing something. { InitializeComponent(); this.dataGridView1.Rows.Add(); } private void button1_Click( object sender, EventArgs e ) { bool value = (bool)( this.dataGridView1.Rows[0].Cells[0].Value ?? false ); this.dataGridView1.Rows[0].Cells[0].Value = !value; } |
|||||||||||||||||||||||