.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Binary reader to read a file.

Posted By:nishithraj       Posted Date: December 27, 2009    Points: 10    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

To read a file, we can use binary reader component.

That is easy to use.

Following is the sample code to read a text file from VB.NET

Using fs As FileStream = File.OpenRead("Samplefile.txt") 
    Dim reader As New BinaryReader(fs)
    Dim intVal As Integer = reader.ReadInt32()
    Dim floatVal As Single = reader.ReadSingle()
    Dim stringVal As String = reader.ReadString()
End Using


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend