readin from files in vsiaul basci

How can i read and write to files in vb
dieterdpAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mayhewConnect With a Mentor Commented:
Sample code from a project I worked on:

'***** Reads data from flat file.

'Get the next free file number.
intFileNumber = FreeFile
   
'Open text data file.
Open strFileName For Input As #intFileNumber
   
'Loop through the flat file.
Do While Not EOF(intFileNumber)
  'Get a line of data from the file and use it to
  'populate an input string variable.
  Line Input #intFileNumber, strInput

  'Process strInput here if desired.
Loop


'Close the data file since we're at the end of the file.
Close #intFileNumber



'***** Writes data to flat file.

'Get the next free file number.
intFileNumber = FreeFile
   
'Open text data file.
Open strFileName For Output As #intFileNumber
   
Print #intFileNumber, "I have some data."  

'Close the data file.
Close #intFileNumber

0
All Courses

From novice to tech pro — start learning today.