The text writer in VB.net

By: Issac Viewed: 153241 times  Printer Friendly Format    


TextWriter is similar to TextReader we can write a given content in a file at one strench in to a file using it. The following sample source showing how write in a file using TextWriter.

Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim writeFile As System.IO.TextWriter = New _
StreamWriter("c:\textwriter.txt")
writeFile.WriteLine("www.m-indya.com")
writeFile.Flush()
writeFile.Close()
writeFile = Nothing
Catch ex As IOException
MsgBox(ex.ToString)
End Try
End Sub
End Class

When you execute this source code, you will get a file TextWriter.txt and inside it written www.m-indya.com



Most Viewed Articles (in VB.net )

Latest Articles (in VB.net)

Comment on this tutorial