READ WRITE wWith Binary Files Convert VB6 to VB.NET TYPE GET PUT????

Hello Experts,
Im using following way(code) to read and write to a binary file in VB6. Now we are Planing to Migrate to VB.NET. Whats the best and easiest way to read and write from a structured binary file? (in some cases they were already generated by VB6). Please Explain with Code Examples. Thanking You
Udana


in module~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Global Product As Productx

        Type Productx
                lngVal1 As Long
                lngVal2 As Long
                strVal1 As String * 6
                lngVal3 As Long
                strVal2 As String * 342
        End Type
In Form~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'command buttons for control and Text boxes for display

Sub Record() 'to record data to Prod.dat
          Close #28: Open "C:\Prod.dat" For Random Shared As #28 Len = 360
      For i = 0 To 100000
      Product.lngVal1 = i
      Product.lngVal2 = i*23
      Product.lngVal3 = i+23
      Product.strVal1 = CSTR(i)
        Put #28, i, Product
      Next i
End Sub

Sub Read() 'read data from Prod.dat
          Close #28: Open "C:\Prod.dat" For Random Shared As #28 Len = 360
        Get #28, 21112, Product
      Text1.Text=Cstr(Product.lngVal1)
      Text2.Text=(Product.lngVal2)
      Text3.Text=(Product.lngVal3)
      Text4.Text=(Product.strVal1)
End Sub
udanabananaAsked:
Who is Participating?
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.

Mike TomlinsonMiddle School Assistant TeacherCommented:
0

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
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.