我在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兼容 你看看在打开这一文件时是否被其他进程使用或其具有系统属性
你要的话我给你我的关于txt I/O的代码
Dim Strfile As String Strfile = FreeFile Open "e:\tips.txt" For Binary As #1 Strfile = LOF(Strfile) Close Strfile 楼上的,这是我得程序,执行通过!!可是,如果,我用一言难尽.txt作为文件名的时候。 就不行了。
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
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方法。好处很多。:) 就是有点麻烦!!不过还可以忍受!!过一会结账!!!
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方法。好处很多。:) 就是有点麻烦!!不过还可以忍受!!过一会结账!!!
何必这么费事?
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兼容
你看看在打开这一文件时是否被其他进程使用或其具有系统属性
Strfile = FreeFile
Open "e:\tips.txt" For Binary As #1
Strfile = LOF(Strfile)
Close Strfile
楼上的,这是我得程序,执行通过!!可是,如果,我用一言难尽.txt作为文件名的时候。
就不行了。
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
--------------
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方法。好处很多。:) 就是有点麻烦!!不过还可以忍受!!过一会结账!!!
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方法。好处很多。:) 就是有点麻烦!!不过还可以忍受!!过一会结账!!!