当前位置:编程学习 > C#/ASP.NET >>

vb.net 控件

 多个NumericUpDown 控件如何在窗体启动之后,选值时他们所选的值都不能相同,如何判断 vb.net 控件 NumericUpDown1 --------------------编程问答--------------------
    Private Function IsExistsValue() As Boolean
        Dim boolExists As Boolean = False
        Dim values As ArrayList = New ArrayList

        For Each numBox As NumericUpDown In Me.Controls
            If TypeOf (numBox) Is NumericUpDown Then
                If values.Contains(numBox.Value) Then
                    boolExists = True
                    Exit For
                Else
                    values.Add(numBox.Value)
                End If
            End If
        Next
        values = Nothing

        Return boolExists
    End Function
--------------------编程问答--------------------
    Private Function IsExistsValue() As Boolean
        Dim boolExists As Boolean = False
        Dim values As ArrayList = New ArrayList

        For Each numBox As Control In Me.Controls
            If TypeOf (numBox) Is NumericUpDown Then
                Dim num As NumericUpDown = CType(numBox, NumericUpDown)
                If values.Contains(num.Value) Then
                    boolExists = True
                    Exit For
                Else
                    values.Add(num.Value)
                End If
            End If
        Next
        values = Nothing

        Return boolExists
    End Function
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,