StreamWriter WriteLine : Stream Writer « File Directory « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » File Directory » Stream WriterScreenshots 
StreamWriter WriteLine

Imports System
Imports System.Data
Imports System.IO

public class MainClass
   Shared Sub Main()
       Dim FileToRead As String = CurDir + "test.txt"
       Dim TestFile As FileStream

       Try
           TestFile = New FileStream(FileToRead, FileMode.Create, FileAccess.ReadWrite)
           Dim Writer As New StreamWriter(TestFile)
           Writer.WriteLine("8")
           Writer.WriteLine("7")
           Writer.WriteLine("0")
           Writer.WriteLine("ABC")
           Writer.WriteLine("5")
           Writer.Flush()
           TestFile.Seek(0, SeekOrigin.Begin)
       Catch CantCreate As Exception
           Console.WriteLine("Can't create or write the file")
           Exit Sub
       End Try
   End Sub
End Class


           
       
Related examples in the same category
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.