Solved

no change-event checkbox in datagridview

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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.net/WinForms: adjust Screen Resolution 6 58
Variable Event ? 3 28
VB.net and sql server 4 36
Winform Module - What is the ASP.Net equiv 2 23
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 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