|
发表于 2013-6-18 09:00
|
显示全部楼层
本楼为最佳答案
- Function CheckInput()
- Dim objControl As Control
- Dim str$
- Dim strTemp
- Dim arr(), i As Byte
- ReDim arr(1 To 60, 1 To 2)
- For Each objControl In Me.Controls
- If TypeName(objControl) Like "CheckBox" Then
- With objControl
- If .Value Then
- strTemp = Me.Controls(Replace(.Name, "CheckBox", "TextBox")).Text
- If Not IsNumeric(strTemp) Or strTemp Like "*[.-]*" Then
- str = str & .Name & " 后面的文本框输入的是非大于0的整数值" & vbCrLf
- Else
- i = i + 1
- arr(i, 1) = Mid(.Name, 9)
- arr(i, 2) = Val(strTemp)
- End If
- End If
- End With
- End If
- Next
- CheckInput = Not Len(str) > 0
- If Not CheckInput Then
- MsgBox str
- Else
- CheckInput = arr
- End If
- End Function
复制代码 |
评分
-
查看全部评分
|