Link to home
Start Free TrialLog in
Avatar of rpg_rpg
rpg_rpg

asked on

how to start reading information...

I would like to make a control to put a bunch of files together and then seperate them. My first problem is... how do I open the file(meaning any file) and start reading the information of that file into VB? It should not matter what file it is or what it contains... The computer sees it the same way. (Just a bunch of numbers) right???
Avatar of clifABB
clifABB

Use:
Open "TESTFILE" For Binary Access Write As #1

Then use Get to input the data:
Get #1, , vVar


... Access Read ...
Good catch Chabaud!

Avatar of rpg_rpg

ASKER

so what is vVar  going to = ? the entire file or just the first byte... And after?
Vvar will equal the first byte the first time it is called, every subsequent call, it will be equal to the next byte.

So, to read an entire file a byte at a time, this code will work:
  Dim btVar  As Byte
  Dim nFile  As Integer

  nFile = FreeFile

  Open "TESTFILE" For Binary Access Read As #nFile
  Do Until EOF(nFile)
    Get #nFile, , btVar

    'Do what you want with btVar
    Debug.Print btVar
  Loop
  Close #nFile

(Thanks to chabaud for pointing out my Access Write error)
Avatar of rpg_rpg

ASKER

clifABB: you did not use this as an answer. Could you please.
ASKER CERTIFIED SOLUTION
Avatar of clifABB
clifABB

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial