VB6有没有判断文本框中输入的数据是否为整型数的函数

解决方案 »

  1.   

    Private Sub Command1_Click() 
        Dim a As Double
        a = 3.143 
        If a = Int(a) Then 
            msgbox "为整型数"
        End If End Sub 
      

  2.   

    写成函数
    Private Sub Command1_Click()
        If fun_IsInt(Text1.Text) Then
            MsgBox Text1.Text & " 为整型数"
        End If
        
    End SubPrivate Function fun_IsInt(ByVal dblNum As Double) As Boolean
        fun_IsInt = False
        
        If dblNum = Int(dblNum) Then
            'MsgBox dblNum & " 为整型数"
            fun_IsInt = True
        End IfEnd Function