I'm attempting to convert some VBA to VB.Net. I have not used VB.Net much as I prefer using C#, however due to the amount of code I need to convert I'm coding a VB.Net dll, which I can use as a reference in the C# application.
I have the following VBA code and need to be able to produce the same in VB.Net
Open FileName For Binary Access Read As #1
Get #1, , customType
Where customType is a user-defined data type. I have replicated the required types as structures in VB.net, however I'm not sure where to start in reproducing this code for VB.Net
Any suggestions would be appreciated.
Update 1:
FileOpen(1, FileName, OpenMode.Binary)
FileGet(1, customStruct)
The above seems to be somewhat working, however I get the following exception when the custom structure has a item defined as an array.
e.g,
Public Structure CustomStruct
Dim FileType() As Byte
End Structure
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in Microsoft.VisualBasic.dll
Additional information: Non-negative number required.
I have initialized the dimensions via,
ReDim customStruct.FileType(7)
Thanks
FileOpenandFileGet, which hopefully is the equivalent in VB.net. Reading is not so much the problem, however assigning the binary read to the custom structure is.