我写了一个函数
Private Function checkform(obj As Object, msg As String)
    If Trim(obj.Text) = "" Then
        MsgBox msg, vbExclamation, "提示"
        Exit Function
    End If
End Function
在Private Sub cmdstuOk_Click()调用
   会谈错该怎么办

解决方案 »

  1.   

    Private Function checkform(obj As Object, msg As String)
        If Trim(obj.Text) = "" Then
            MsgBox msg, vbExclamation, "提示"
            Exit Function
        End If
    End Function改成这样:Private Function checkform(strText As strText, msg As String)
        If Trim(strText) = "" Then
            MsgBox msg, vbExclamation, "提示"
            Exit Function
        End If
    End Function其中strText是obj.text
      

  2.   

    上面的错了一点。Private Function checkform(obj As Object, msg As String)
        If Trim(obj.Text) = "" Then
            MsgBox msg, vbExclamation, "提示"
            Exit Function
        End If
    End Function改成这样:Private Function checkform(strText As string, msg As String)
        If Trim(strText) = "" Then
            MsgBox msg, vbExclamation, "提示"
            Exit Function
        End If
    End Function其中strText是传进来的obj.text
      

  3.   

    在cmd_click怎么调用
    checkform(txtstuname.Text,"学员名称不能为空")
    这样会出错怎么办