Datagridview复选框列的值

编程入门 行业动态 更新时间:2024-10-27 19:26:08
本文介绍了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

If dgvIDsTBC.CurrentRow.Cells(2).Value = True Then MsgBox("True") End If

请告知为此使用什么事件. 谢谢 Furqan

Please advise what event to use for this. Thanks Furqan

推荐答案

使用CellContentClick Use CellContentClick Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick MsgBox(DirectCast(sender, Forms.DataGridView).Rows(e.RowIndex).Cells(e.ColumnIndex).EditedFormattedValue) End Sub

更多推荐

Datagridview复选框列的值

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

发布评论

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

>www.elefans.com

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