又有问题了
我想写一个程序
作用如下
先判断指定目录下是否有指定文件,有,则删除,没有则,执行下面的程序
如何实现呢

解决方案 »

  1.   

    引用microsoft scripting runtime
    Option Explicit
    Dim fs As New FileSystemObjectPrivate Sub Command1_Click()
    If fs.FileExists("c:\test\a.bmp") Then
       fs.DeleteFile "c:\test\a.bmp"
    Else
    MsgBox "没有"
    End IfEnd Sub
      

  2.   

    用dir$函数判断文件是否存在也好使。
      

  3.   

    又有问题了
    我想写一个程序
    作用如下
    有一组控件数组textbox,判断它们的内容是否相同,相同警告斌执行相关程序
    不同则执行下面的程序
      

  4.   

    http://community.csdn.net/Expert/topic/3153/3153886.xml?temp=.8786127已经回答了
      

  5.   

    http://community.csdn.net/Expert/topic/3153/3153891.xml?temp=.3997309第一个问题。
      

  6.   

    If Dir("C:\WINDOWS\fdfd.ini") Then
        Kill "C:\WINDOWS\fdfd.ini"
    Else
        
    End If
      

  7.   

    第二个问题
    自己写一个函数返回真,则相同,否则不同
    Function blnCompare() As Boolean
        Dim lngCnt&, lngCnt2
        For lngCnt = 0 To Text1.Count - 1
           For lngCnt2 = 0 To Text1.Count - 1
               If lngCnt <> lngCnt2 Then
                   If Text1(lngCnt) <> Text1(lngCnt2) Then
                       blnCompare = False
                       Exit Function
                   End If
               End If
           Next
        Next
        blnCompare = True
    End FunctionPrivate Sub Command1_Click()
        If blnCompare Then
            MsgBox "相同"
        Else
            MsgBox "不同"
        End If
    End Sub