vb 问题,希望各位的帮忙

来源:百度知道 编辑:UC知道 时间:2024/06/02 12:06:06
编一函数过程,对输入的正整数N,判断是否是回文数。函数返回值类型为布尔型。从text1中每输入一个数,按回车键后调用函数过程,然后在text2中显示输入的数,若是回文数就在该数后面加一个“※”

Private Function ReturnB(Number As Long) As Boolean
    Dim s As String, Length As Long
    Dim n As Long
    s = CStr(Number)
    Length = Len(s)
    
    ReturnB = True
    For n = 1 To Length \ 2
        If Mid(s, n, 1) <> Mid(s, Length - n + 1, 1) Then ReturnB = False
    Next
End Function

Private Sub Command1_Click()
    Text2.Text = Text1.Text
    If ReturnB(CLng(Text1.Text)) = True Then Text2.Text&nbs