Random files and nested structures in VB.Net

vb.net Philippines
  • 13 years ago

    My existing VB6 programs make extensive use of random files read and written to using complex structures.  For example...
     
    Private Type RightsElement
       ItemName As String * 10
       ItemFolder As String * 32
    End Type
     
    Private Type OneUser
       UserName As String * 20
       Password As String * 20
       AllRights (0 to 64) As RightsElement
    End Type
     
    I could then declare a variable such as ThisUsersRights As OneUser, and subsequently read or write to a random file using this variable.
     
    I have tried in vain to make this work in VB.Net 2008.  I NEED to be able to read my existing files.  Can anyone offer any suggestions?  Or perhaps point me in the right direction for getting an answer?

    Thanks.  Steve.

     

  • 13 years ago
    You can use a BinaryReader to read binary objects from a file.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.” - Donald Knuth