vb System.Windows.Forms.DataGridViewCellValidatingEventArgs.FormattedValue类(方法)实例源码

下面列出了vb System.Windows.Forms.DataGridViewCellValidatingEventArgs.FormattedValue 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:System.Windows.Form   
Private Sub dataGridView1_CellValidating(ByVal sender As Object, _
    ByVal e _
    As DataGridViewCellValidatingEventArgs) _
    Handles dataGridView1.CellValidating

    Me.dataGridView1.Rows(e.RowIndex).ErrorText = ""
    Dim newInteger As Integer

    ' Don't try to validate the 'new row' until finished 
    ' editing since there
    ' is not any point in validating its initial value.
    If dataGridView1.Rows(e.RowIndex).IsNewRow Then Return
    If Not Integer.TryParse(e.FormattedValue.ToString(), newInteger) _
        OrElse newInteger < 0 Then

        e.Cancel = True
        Me.dataGridView1.Rows(e.RowIndex).ErrorText = "the value must be a non-negative integer"

    End If
End Sub


问题


面经


文章

微信
公众号

扫码关注公众号