dim Con as control
for each Con in form1.controls
if typeof(Con) is textbox then
if trim(con.text)="" then
msgbox "...."
end if
end if
next
我想把它写成一个公用的函数来调用应该怎么写.
...全文
1493打赏收藏
怎样写一公用函数
dim Con as control for each Con in form1.controls if typeof(Con) is textbox then if trim(con.text)="" then msgbox "...." end if end if next 我想把它写成一个公用的函数来调用应该怎么写.
你可以将以下代码放入一模块中:
Public Sub LookText(frmLook As Form)
Dim Con As Control
For Each Con In frmLook.Controls
If TypeOf Con Is TextBox Then
If Trim(Con.Text) = "" Then
MsgBox "....", , frmLook.Caption
End If
End If
Next
End Sub
应该这么写:
Public Sub Procdure(frmParam as Form)
dim Con as control
for each Con in frmParam.controls
if typeof(Con) is textbox then
if trim(con.text)="" then
msgbox "...."
end if
end if
next
End Sub