When i click "showcontents" it should display something like this in the label IF the file is non-text.

The problem is it would not show some non-text files.. or it would only display a few characters like "MZ"

Another is the copy button doesnt work. It should copy a file from the source to destination one byte at a time.


heres the copy and read part of my code, any help would be very much appreciated.. :D :D :D

Dim thefile, sAscii, thefile2, dAscii As String
Dim bUnicode() As Byte
Dim aUnicode() As Byte
Dim g1 As Integer
Dim g2 As Integer
Dim i, ff As Integer
Dim j, l As Integer

Public Sub Binary_read()

thefile = File1.Path + "\" + File1.FileName
'get file id
ff = FreeFile
Open thefile For Binary As #ff
    ReDim bUnicode(LOF(ff))
    Get #ff, , bUnicode
Close #ff

sAscii = StrConv(bUnicode, vbUnicode) 'Key function!

lbl_content.Caption = sAscii
End Sub

Public Sub Binary_copy()

thefile = File1.Path + "\" + File1.FileName
thefile2 = Dir2.Path
'get file id
g1 = FreeFile
Open thefile For Binary As #g1
g2 = FreeFile
Open thefile2 For Binary As #g2
Do Until EOF(g1)
    ReDim aUnicode(LOF(g2))
    Get #g1, , aUnicode
    Put #g2, , aUnicode
Close #g1
Close #g2
End Sub

Edited by shawarmah: n/a

7 Years
Discussion Span
Last Post by vb5prgrmr

You really need to loop up the Get Function in help... and then look up the Input Function or the InputB Function...

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.