Beranda > Java Tutorial, Sinaung > demo penggunaan stream writer dan stream reader

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

Sumber: http://stikomksi2007azwar.wordpress.com/2007/11/04/demo-penggunaan-stream-writer-dan-stream-reader/

  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: