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

Posted on 2006-03-29
Last Modified: 2011-09-20
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

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
End Sub
Question by:udanabanana
    1 Comment
    LVL 85

    Accepted Solution


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now