demo penggunaan stream writer dan stream reader

‘ dengan menggunakan namespace system.IO.streamwriter ataupun streamreader kamu dapat menulis/membaca sebuah data dalam file ‘dalam format apapun
‘ syaratnya adalah kamu harus meletakkan file misal: file notepad dalam satu folder

——– demo streamwriter—————————
Imports System.IO

Public Class tulisan

Shared Sub Main(ByVal args As String())

Dim s As String
s = “haloooo semua”
Dim mstream As Stream = New MemoryStream
Dim tulis As StreamWriter = New StreamWriter(“test.txt”)
tulis.Write(s)
tulis.Flush()
mstream.Seek(0, SeekOrigin.Begin)
tulis.Close()

End Sub
End Class

——demo  stream reader——

Imports System.IO

Public Class tulisan

Shared Sub Main(ByVal args As String())

Dim baca As new StreamReader(“test.txt”)
TextBox1.Text = baca.ReadToEnd
TextBox1.Select(0, 0)
baca.Close()

End Sub
End Class

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: