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