FileStream class and StreamReader class in VB.NET
File Stream class used to read from, write to, open and to close file any location within a file system.Stream class is used to read from and to write character from the text file.
File Stream class used to read from,
write to, open and to close file any location within a file system.
As New FileStream ("Filename
with location", FileMode Enumerator,
Enumerator: Used to opening file.
method use to create a new file if does not exist, if exists place the
cursor at the end of file.
Create: Create method use to create anew file.
CreateNew: CreateNew method use to create a new file and specifies to an
Open: Open method use to open an existing file.
Open or Create: This method specifies to the operating system that it should
opens file if it exists, otherwise it should create a new file.
Truncate: This method open an existing file. When opened the file should be
truncated so that its size is Zero bytes.
FileAccess Enumerator : Used to read
from and write to file or perform both operation together. It used three method
read, write and readwrite.
FileShare Enumerator : File share allow that other FileStream constructor
can have to same file. It used six method are inheritance, none, read, readwrite,
write and delete.
Stream class is
used to read from and to write character from the text file and it is an
abstract method which support reading and writng bytes into it.
StreamReader used to read data only from a text file.
used method are listed below.
method used to close the object of StreamReader class and release all
resources associated with the StreamReader class.
method return the next available character but does not consume it.
method reads the next consecutive character from the stream.
This method read a line of characters from the current stream and returns
data as string.
method allow the read and write position to be moved to any position within
Open notepad and
save with check.txt name.
Dim fr As
As String = s.ReadLine()
str = s.ReadLine()