Conversion from VB6 to

I had this in VB 6:

public type Data
     no1(49) as byte
     no2(49) as byte
end type

Then in the program I read bytes (byte by byte) from a file with this statement:

Get #1, , Data

This cause single bytes from a file to populate 'no1' and no2' alternating until
the file is read to the end.

I just cannot figure out how to do the same thing in, specifically vb2010.

I have tried this:

 Using fsSource As FileStream = New FileStream(pathSource, _
                                           FileMode.Open, FileAccess.Read)
                        Data.No1(i) = fsSource.ReadByte
                        Data.No2(i) = fsSource.ReadByte
                        increase += 1
 End Using

Any suggestions?  Thanks in advance
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the VBFixedStringAttribute
Structure Person
    Public ID As Integer 
    Public MonthlySalary As Decimal 
    Public LastReviewDate As Long
    <VBFixedString(15)> Public FirstName As String
    <VBFixedString(15)> Public LastName As String
    <VBFixedString(15)> Public Title As String
    <VBFixedString(150)> Public ReviewComments As String 
End Structure

Open in new window

And to read and write from files: . The example is in C#, you can use to convert the C# to VB.NET

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GCCalAuthor Commented:
Fantastic guidance.....I can see how that will work.

Thanks for the quick response and assistance.
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Also follow all the various links at Declaring Variables for Random File Access.  They'll tell how you how to declare the structure and open the file so you can read in the "records"...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.