I am using the following code to write and empty (dummy) file to take up the remaining space on a device.

RemSpace is a Public Variable declared as Long

I have a function that gets the remaining space on the device and stores in the RemSpace variable (in bytes).

I have tested with a msgbox to display the result of RemSpace, and it comes back correct (not 0). However, when the following code attempts to create the dummy file, the file is properly created but is only 0 bytes. What am I missing here? Thanks for any clarification.

Code:
 'Create the dummyfile to take up the remaining space on the drive
Dim myStreamWriter As New IO.StreamWriter("F:\dummyfile.txt")

        For i As Integer = 1 To RemSpace
            myStreamWriter.Write("")
        Next
        myStreamWriter.Close()
        myStreamWriter.Dispose()
        myStreamWriter = Nothing