vidiware Posted May 1, 2003 Posted May 1, 2003 In VB 6 you could write somehting like: Open xxx for input as #1.... can someone explain me in detail how you opens a textfile for input or output in VB.NET? Quote
a_jam_sandwich Posted May 1, 2003 Posted May 1, 2003 Dim MyFile As IO.StreamWriter MyFile = New System.IO.StreamWriter("c:\test.txt", True) ' True for appending MyFile.WriteLine("THIS IS A LINE OF TEXT") ' Write text to file MyFile.WriteLine("THIS IS ANOTHER") MyFile.Close() ' Close file Hope this helps nice and easy Andy Quote Code today gone tomorrow!
Guest mutant Posted May 1, 2003 Posted May 1, 2003 Add MyFile.Flush() before closing to make sure you dont loose any text that you want to write into the file. Quote
a_jam_sandwich Posted May 1, 2003 Posted May 1, 2003 True thx forgot that Andy Quote Code today gone tomorrow!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.