本文介绍了“取消"在DataGridView CellValidating事件中给出了构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建项目时,我的e.cancel语句出现以下错误:

``取消''不是``System.Windows.Forms.DataGridViewCellEventArgs''的成员

这是我的活动代码:

When I Build my project, I get the following error on my e.cancel statement:

''cancel'' is not a member of ''System.Windows.Forms.DataGridViewCellEventArgs''

Here''s the code in my event:

Private Sub dgvPhysCME_CellValidating(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles dgvPhysCME.CellValueChanged

    'Bypass CellValidation when building/showing DataGridView
    If e.RowIndex = -1 Then Exit Sub

    'Clear ErrorText before testing cell value
    dgvPhysCME.Rows(e.RowIndex).ErrorText = ""

    'If cell is not null, exit sub
    If Not IsDBNull(dgvPhysCME.Rows(e.RowIndex).Cells(e.ColumnIndex).Value) Then Exit Sub

    dgvPhysCME.Rows(e.RowIndex).ErrorText = "Field must not be empty"

    '*** This is where I'm getting the Build Error ***
    e.cancel = True

End Sub

推荐答案

private void dgvPhysCME_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) Handles dgvPhysCME.CellValidating




DataGridViewCellValidatingEventArgs具有取消属性.

欢呼




The DataGridViewCellValidatingEventArgs has a Cancel property.

Cheers



这篇关于“取消"在DataGridView CellValidating事件中给出了构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 19:29