2005 Studio headache

E

Echo

Hi all. Sorry about the crude headline but this problem is really
giving me a headache. See I am currently deloping an app in Visual
Studios 2005 C# Lanuage and the thing is like this: I have a
DataGridView on my form. In this DataGridView is a
DataGridViewCheckBoxColumn and I want to get the value (either true or
false) as I click on the cell(meaning when I change the checked box
unchecked or the other way around) Now like a regular checkbox I want
to use something like Checked so that I can also change the column
programmatically. But there isn't any events or something like that.
The DataGridView is not databound to my database. The connections and
commands are handled seperately in another program. All I want is a
messagebox to show me after I clicked on the DataGridCheckBoxColumn to
show me either checked(true) or unchecked(false)

Please can anybody help me. I gratly appreciate any kind of help on
this.

Thanks
Echo
 
G

Guest

Did you check out the current cell value

like this

I hope this helps you out :)

private void dgrd_RowValidating(object sender,
DataGridViewCellCancelEventArgs e)
{

if (
dgrd.CurrentRow.Cells[0].Value == null
||

String.IsNullOrEmpty(dgrd.CurrentRow.Cells[0].Value.ToString())
)
{
bool b=Convert.ToBoolean(dgrd.CurrentRow.Cells[0].Value);
}
}
 
E

Echo

Hi me again. Thanks for the replies but actually none of them actually
work. It brings me with a messagebox that shows 'true' all the time
until I press Enter key twice then it changes to false. Here is a
sample code for a standard checkbox. Is there a way on how I can use it
with that column?

eg. MessageBox.Show(checkBox1.Checked.ToString());

See I am looking for a code snippet but I can't find it for the
DataGridViewCheckBoxColumn that can also use the Checked.ToString()
function. Is there another way around?
Thanks for the replies and help.

Echo
 

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