Solved

no change-event checkbox in datagridview

Posted on 2007-11-21
4
1,267 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

Industry Leaders: 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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

622 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