how can i write an entire structure to a file without putting each individual member in seperately.
here is the part of my code that deals with this:
As you can see i have quite a few arrays that aren't totally declared yet, cuz i need to resize them during run-time. I thought i remembered using this same method before, but i don't know if i had undimensioned arrays, is that the problem? vb isn't smart enough to save arrays that don't have fixed lengths?Code:Private Type Deviations Average As Double Deviation As Double End Type Private Type Statistics HydrogenCounts As Long OxygenCounts As Long BackgroundCounts As Long HydrogenCorrected As Double OxygenCorrected As Double Ratio As Double End Type Private Type FileInfo Filename As String Path As String Import As String Export As String Workbook As String PictureFile As String Filter As String Title As String Prefix As String End Type Private Type BinNumber Bin(1 To 1024) As Long End Type Private Type tofFiles Info As FileInfo IsFileCalculated As Boolean SumData(1 To 1024) As Long TotalRecords As Integer RawData() As BinNumber RawStats() As Statistics SumStats As Statistics Deviation As Deviations End Type Dim tofFile() As tofFiles Private Sub Form_Unload(Cancel As Integer) Open App.Path & "\Data.tof" For Binary As #1 Put #1, , tofFile() Close #1 Unload Form2 End Sub Private Sub Form_Load() Open App.Path & "\Data.tof" For Binary As #1 Get #1, , tofFile() Close #1 End Sub
thanx




Reply With Quote