随便招本windows的书,应该有的,如
第一个字符必须为字母

解决方案 »

  1.   

    现在window文件名不能出现的字符只有/\<>|?:*"这九个字符了,你写九行程序就判断出来了,做成函数,以后调用就是了。
    function isFile(byval strName as string) as boolean
        dim Tag as integer    Tag = 0
        Tag = Tag + instr(strName,"/")
        Tag = Tag + instr(strName,"""")  '判断双引号    .
        .      '其余类似    if Tag > 0 then
            isFile = False
        else
            isFile = True
        end if
    end funciton
      

  2.   

    win95以后首字母不见得是字母了,我建立过文件名为'.{].txt的文件,对了,上边的函数忘了判断文件名长度是否为零了
      

  3.   

    Private Sub Command1_Click()
    Dim IsPass As Boolean, Filename As String
    Filename = "12345?.bmp"
    IsPass = True
    For i = 1 To Len(Filename)
        s = Mid(Filename, i, 1)
        Select Case s
            Case "?", "/", "*" '其他不允许的字符
                IsPass = False
                Exit For
            Case Else
        End Select
    Next
    If IsPass = True Then
        '合法
    Else
        '不是合法文件名
    End If
    Print IsPass
    End Sub