Imports System.IO

Public Class Form1

 

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Me.Close()

    End Sub

 

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim fs As FileStream = New FileStream("C:\Data.bin", FileMode.OpenOrCreate)

        Dim w As BinaryWriter = New BinaryWriter(fs)

        Dim ctr As Int32

        For ctr = 0 To 19

            w.Write(ctr)

        Next

        w.Seek(0, SeekOrigin.Begin)

        Dim r As System.IO.BinaryReader = New System.IO.BinaryReader(fs)

 

        For ctr = 0 To 19

            Me.RichTextBox1.Text &= r.ReadInt32() & ControlChars.CrLf

        Next

    End Sub

End Class