if len(text1.text)<15 then msgbox "错误"

解决方案 »

  1.   


    private sub cmdOK_Click()  if len(text1.text)<15 or len(text1.text>18) then
          msgbox "错误"
          exit sub
      end if  输入正确
      继续处理
    end sub
                        ================================
                        欢迎大家来:http://www.myvc.net/
                        ================================
      

  2.   

    只要在文本框市区焦点是写入下代码即可。
    Private Sub Text1_LostFocus()
    If Len(Text1) < 15 Or Len(Text1) > 18 Then
        MsgBox ("error")
        Text1.SetFocus
    End If
    End Sub
      

  3.   

    not 市区  is 失去
      

  4.   

    将文本框的CauseValidate属性置为True(默认为True),响应Validate事件。该事件是用于文本框失去焦点时进行校验用的。更具体的查查MSDN吧!