Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

no change-event checkbox in datagridview

Posted on 2007-11-21
4
Medium Priority
?
1,270 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
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
razo earned 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

824 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