Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
VB Struct query (converted from VB6 Type)
I am currently migrating a VB6 project to VB.NET. I used the VS tool that converts VB6 code to VB.NET code. The conversion changed a VB6 Type to a VB.NET Structure.
The user-defined Type construct was used in a Get/Put where a binary file was read in or written out based on the user-defined Type. Apaprently, the Get/Put was able to do this easily.
During the conversion the Get/Put were changed to FileGet/FilePut but apparently these cannot automatically read in or write out bytes in a Type construct way.
In any event, I decided to replace the FileGet/FilePut code to the .NET FileStream and BinaryReader and BinaryWriter constructs.
What I am now trying to do is to write a class where I take a structure as a paramter and want to read and write the bytes in the same field order as the VB6 Type construct. Looking into the Structure format (which I know is somewhat similar to a Class), there does not seem to be an east way to discern the order the fields are in for reading/writing bytes.
Does anyone have thoughts on the best approach to solving this problem?