不好意思刚才有个地方有点问题就是a(i)=Ctype(d.TextBox).Text 不应该是a(i) 而应该是a(j)
dim a(16) as String
dim j as integer =0
For Each d As Control In Me
If TypeOf d is TextBox then
dim i =0
for i =0 to 16
if a(i)=Ctype(d.TextBox).Text then
Ctype(d.TextBox).foucs()
return false
End if
next i
if i=16 then
a(j)=Ctype(d.TextBox).Text
end if
j+=1
End IF
Next
reutrn true
End Function
Public Function CHeckValue() As Boolean
dim a(16) as String
For Each d As Control In Me
If TypeOf d is TextBox then
dim i =0
for i =0 to 16
if a(i)=Ctype(d.TextBox).Text then
Ctype(d.TextBox).foucs()
return false
End if
next i
if i=16 then
a(i)=Ctype(d.TextBox).Text
end if
End IF
Next
reutrn true
End Function
Public Function CHeckValue(ByVal Tlist As TextBox()) As Integer
For d As Integer = 0 To Tlist.Length
Dim CurrText As TextBox = Tlist(d)
If Trim(CurrText.Text).Length > 0 Then
For i As Integer = 0 To Tlist.Length
Dim compText As TextBox = Tlist(i)
If i <> d Then
If compText.Text.Trim.Length > 0 Then
If String.Compare(compText.Text, CurrText.Text) <> 0 Then
Return i
End If
End If
End If
Next
End If
Next
End Function
那个数组就你自己做了,这样应该能用