Solved

no change-event checkbox in datagridview

Posted on 2007-11-21
4
1,265 Views
Last Modified: 2009-06-15
I have a datagridview but i can't find the change-event of the checkbox.

Thanks in advance.

Dirk
0
Comment
Question by:dgb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
razo earned 500 total points
ID: 20327222
u can check the cellvaluechanged or cellcontentclick events
0
 

Author Comment

by:dgb
ID: 20327370
The cellvaluechanged doesn't fire when a checkbox has been checked/unchecked.
(it does fire when leaving the cell, but that doesn't work for me)

The cellcontentclick is also not working as it should.
When repeatedly click the checkbox i can not ask what the current value is.
0
 

Author Comment

by:dgb
ID: 20327521
I've been testing and if i manualy set the checkbox value it seems to go ok

' In the CellContentClick-event
After processing the checked-change i have to execute the following command else it doesn't work.
DataViewGrid.CurrentCell.Value = Not DataViewGrid.CurrentCell.Value
0
 

Expert Comment

by:ahmedcoeur
ID: 24633937

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
       ' my check box colum is the last grid colum
        If e.ColumnIndex = (Me.DataGridView1.Columns.Count - 1) Then
            If Me.DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = True Then
                Me.DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = False
                MessageBox.Show(Me.DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value)
 
            Else
                Me.DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = True
                MessageBox.Show(Me.DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString())
            End If
 
        End If
    End Sub

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question