PC Review


Reply
Thread Tools Rate Thread

DataGridView checkbox.

 
 
Mr. X.
Guest
Posts: n/a
 
      24th Jun 2010
When I use dataGridView, and one of it's elements is a checkBox.
How can I catch the event, exactly when the checkBox is changed.
CellValueChanged is not good enough, since the event occurs after both two
steps :
1. I change the value of the cell.
2. I move to another cell.

I want exactly when the checkBox.checked is changed
(DataGridViewCheckBoxCell).

Thanks

 
Reply With Quote
 
 
 
 
Phill W.
Guest
Posts: n/a
 
      24th Jun 2010
On 24/06/2010 11:54, Mr. X. wrote:
> When I use dataGridView, and one of it's elements is a checkBox.
> How can I catch the event, exactly when the checkBox is changed.


> I want exactly when the checkBox.checked is changed
> (DataGridViewCheckBoxCell).


Handle the CurrentCellDirtyStateChanged event; in this routine, if the
CurrentCell happens to be a DataGridViewCheckBoxCell, call CommitEdit;
that should get the CellChanged event to fire straight away.

HTH,
Phill W.
 
Reply With Quote
 
Mr. X.
Guest
Posts: n/a
 
      24th Jun 2010
Thanks.
How can I see the "dirty" new-value.
On CurrentCellDirtyStateChanged, I can see the old-value.

Thanks

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-k> wrote in message
news:hvvfd3$j9k$(E-Mail Removed)...
> On 24/06/2010 11:54, Mr. X. wrote:
>> When I use dataGridView, and one of it's elements is a checkBox.
>> How can I catch the event, exactly when the checkBox is changed.

>
>> I want exactly when the checkBox.checked is changed
>> (DataGridViewCheckBoxCell).

>
> Handle the CurrentCellDirtyStateChanged event; in this routine, if the
> CurrentCell happens to be a DataGridViewCheckBoxCell, call CommitEdit;
> that should get the CellChanged event to fire straight away.
>
> HTH,
> Phill W.


 
Reply With Quote
 
Mr. X.
Guest
Posts: n/a
 
      24th Jun 2010
I meant - to check the value of the object to be changed to, and for some
condition do : cancelEdit.

Thanks

"Mr. X." <nospam@nospam_please.com> wrote in message
news:(E-Mail Removed)...
> Thanks.
> How can I see the "dirty" new-value.
> On CurrentCellDirtyStateChanged, I can see the old-value.
>
> Thanks
>
> "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-k> wrote in message
> news:hvvfd3$j9k$(E-Mail Removed)...
>> On 24/06/2010 11:54, Mr. X. wrote:
>>> When I use dataGridView, and one of it's elements is a checkBox.
>>> How can I catch the event, exactly when the checkBox is changed.

>>
>>> I want exactly when the checkBox.checked is changed
>>> (DataGridViewCheckBoxCell).

>>
>> Handle the CurrentCellDirtyStateChanged event; in this routine, if the
>> CurrentCell happens to be a DataGridViewCheckBoxCell, call CommitEdit;
>> that should get the CellChanged event to fire straight away.
>>
>> HTH,
>> Phill W.

>

 
Reply With Quote
 
Mr. X.
Guest
Posts: n/a
 
      25th Jun 2010
Thanks.
Everything was solved. Ignore the rest.
(There are situation, that when I do commitEdit, and reach the
CellValueChanged, I am in state of edit mode. co I can do endEdit on some
circumstances,
I.e, when the checkbox is invalid value, for some cases, and I need to
restore it to original value).

Thanks

"Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-k> wrote in message
news:hvvfd3$j9k$(E-Mail Removed)...
> On 24/06/2010 11:54, Mr. X. wrote:
>> When I use dataGridView, and one of it's elements is a checkBox.
>> How can I catch the event, exactly when the checkBox is changed.

>
>> I want exactly when the checkBox.checked is changed
>> (DataGridViewCheckBoxCell).

>
> Handle the CurrentCellDirtyStateChanged event; in this routine, if the
> CurrentCell happens to be a DataGridViewCheckBoxCell, call CommitEdit;
> that should get the CellChanged event to fire straight away.
>
> HTH,
> Phill W.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagridview checkbox Cdude Microsoft C# .NET 3 30th Apr 2010 07:16 PM
datagridview checkbox mrstrong Microsoft C# .NET 2 24th Sep 2007 02:55 AM
DataGridView Checkbox Carolina Microsoft Dot NET Framework Forms 3 17th Sep 2007 08:14 PM
datagridview checkbox mrstrong Microsoft Dot NET Framework Forms 6 13th Sep 2007 12:35 AM
Get value of a checkbox in a datagridview =?Utf-8?B?RGF2ZQ==?= Microsoft C# .NET 0 16th Oct 2006 10:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:45 AM.