Datagridview复选框列的

编程入门 行业动态 更新时间:2024-10-28 01:12:44
本文介绍了Datagridview复选框列的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个带复选框列的datagridview.我想在用户通过单击更改复选框时立即捕获其值.我尝试了几个事件(CellValueChanged,CellClicked,CurrentCellDirtyStateChanged等),但没有任何效果. 我的代码是

Hi, I have a datagridview with a checkbox column. I want to capture the value of checkbox immediately when user changes it by clicking. I tried several events (CellValueChanged, CellClicked,CurrentCellDirtyStateChanged etc.) but nothing worked. My code is

Private Sub DataGridViewX3_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewX3.CellContentClick If DataGridViewX3.Rows(DataGridViewX3.CurrentCell.RowIndex).Cells(8).Value = True Then DataGridViewX3.Rows(DataGridViewX3.CurrentCell.RowIndex).Selected = True End If

推荐答案

请检查以下帖子.他们也接受了答案. 1. 在DataGridView C#中触发复选框值更改事件. NET [ ^ ]. 2. Datagridview checkbox.checked事件 [ ^ ]. 3. 在Windows Forms DataGridview中捕获复选框单击事件 [ ^ ] . 快乐编码 谢谢... Please check the below posts. They have accepted answers also. 1. Triggering a checkbox value changed event in DataGridView C#.NET[^]. 2. Datagridview checkbox.checked event[^]. 3. Capturing Checkbox click event in Windows Forms DataGridview[^]. Happy coding Thanks...

Private Sub DataGridViewX3_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)Handles DataGridViewX3.CellContentClick DataGridViewX3.CommitEdit(DataGridViewDataErrorContexts.Commit) End Sub Private Sub DataGridViewX3_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridViewX3.CellValueChanged '' do something with grid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value End If End Sub

更多推荐

Datagridview复选框列的

本文发布于:2023-11-07 08:59:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566040.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:复选框   Datagridview

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!