如果用Open "e:\tips.txt" For Binary As #1 就可以了!!!

解决方案 »

  1.   

    用commondialog控件的showopen属性
      

  2.   

    如果用Open "e:\tips.txt" For Binary As #1 就可以了!!!
      

  3.   

    filelen就可以获得一个文件的大小了
    何必这么费事?
      

  4.   

    我在word xp的vb for application中实验了如下代码
    Sub main()
      Open "f:\一言难尽.txt" For Binary As #1
      Input #1, ss
      MsgBox ss
      Close 1
    End Sub
    毫无问题
    office xp的vb for application与vb 6.0兼容
    你看看在打开这一文件时是否被其他进程使用或其具有系统属性
      

  5.   

    你要的话我给你我的关于txt I/O的代码
      

  6.   

    Dim Strfile As String
    Strfile = FreeFile
    Open "e:\tips.txt" For Binary As #1
    Strfile = LOF(Strfile)
    Close Strfile
    楼上的,这是我得程序,执行通过!!可是,如果,我用一言难尽.txt作为文件名的时候。
    就不行了。
      

  7.   

    xfflean(雄):谢谢!!我是要对数据库添加图片,已经可以了,但是,对于用中文命名的文本文件,我无法读出文件的大小,用上面的方法!我想用上面的方法读初中文明名的文本文件的大小。[email protected]
      

  8.   

    dim strfile as string?????
    Dim strfile as integer,filebyes as long,byead() as bye
    strfile=freefile
    if commondialog1.filename="" then exit sub
    filebyes=filelen(commondialog1.filename)
    open commondialog1.filename for binary as strfile
    redim byead(1 to filebyes)
    get #strfile,,byead
    close #strfile
    doevents
      

  9.   

    xfflean(雄):你的程序有几个小bug。你看看我改过后的。
    --------------
    Dim strfile As Integer, filebyes As Long, byead() As Byte
    strfile = FreeFile
    If dlgPicture.FileName = "" Then Exit Sub
    filebyes = FileLen(dlgPicture.FileName)
    Close #1
    Label1.Caption = filebyes
    不用open方法
    --------------------------------------------------
    Dim strfile As Integer, filebyes As Long, byead() As Byte
    If dlgPicture.FileName = "" Then Exit Sub
    Open dlgPicture.FileName For Binary As strfile
    strfile = LOF(strfile)
    Close #1
    Label1.Caption = strfile
    使用open方法。好处很多。:) 就是有点麻烦!!不过还可以忍受!!过一会结账!!!
      

  10.   

    Dim strfile As Integer, filebyes As Long, byead() As Byte
    strfile = FreeFile
    If dlgPicture.FileName = "" Then Exit Sub
    filebyes = FileLen(dlgPicture.FileName)
    Open dlgPicture.FileName For Binary As strfile
    strfile = LOF(strfile)
    Close #1
    Label1.Caption = strfile
    对不起,有个错误!!这次好了!
    使用open方法。好处很多。:) 就是有点麻烦!!不过还可以忍受!!过一会结账!!!