More Simple Questions --- Reading/Writing Files

  • Thread starter Thread starter A. Gaubatz
  • Start date Start date
A

A. Gaubatz

In VB6, I would open files with:

Open <file name> For <input/output/append> As <file number>

I could then use the Write/Input commands to modify/read the file. How
do I do this in VB.NET?

Thanks
 
Use System.IO namespace types. A sample is here
http://www.startvbdotnet.com/files/default.aspx

Also check out MSDN for more samples.

In VB6, I would open files with:

Open <file name> For <input/output/append> As <file number>

I could then use the Write/Input commands to modify/read the file. How
do I do this in VB.NET?

Thanks
 
A.,

Those VB6 techniques will still work in VB.Net, with a few minor changes.

For example, instead of Open, use FileOpen.

VB.Net can also use the classes in the System.IO namespace.

Kerry Moorman
 
A. Gaubatz said:
I could then use the Write/Input commands to modify/read the file. How
do I do this in VB.NET?

File Access with Visual Basic Run-Time Functions:

Visual Basic Language Concepts -- File Access with Visual Basic Run-Time
Functions
<URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vbconProcessingFiles.asp>

- or -

..NET Framework Class Library -- 'FileStream' Class
<URL:http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemIOFileStreamClassTopic.asp>

..NET Framework Class Library -- 'StreamWriter' Class
<URL:http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemiostreamwriterclasstopic.asp>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top