Save structure to XML file - URGENT PLEASE
Hello,
i've got this structure :
Public Structure infor
Public tx As Integer 'Coordinate Top X
Public ty As Integer 'Coordinate Top Y
Public bx As Integer 'Coordinate Bottom X
Public by As Integer 'Coordinate Bottom Y
End Structure
And this variables :
Dim cuttings(50, 1000) As infor ' the cuttings in each sheet. no more than 50 sheets and no more than 1000 cuttings in each sheet
Dim pieces(50, 1000) As infor ' the pieces in each sheet
Dim wastes(50, 1000) As infor 'the wastes in each sheet
Dim no_wastes(50) As Integer 'number of wastes in each sheet
Dim no_pieces(50) As Integer ' number of rectangles in each sheet
Dim no_cuttings(50) As Integer ' number of cuttings in each sheet
And i need to save this info to a xml file to view it later... i can have from 1 to 50 pieces... how can i do it?
Someone can help me?
It kinda urgent please...
Re: Save structure to XML file - URGENT PLEASE
Re: Save structure to XML file - URGENT PLEASE
Serialization is perfect for things like this, it will save the object as is, and when you deserialize it, you dont need to reinitialize it either....
Code:
Imports System.Runtime.Formatters.BinaryFormatters
Class anyClass
Public sub SaveObj(byval obj as yourClass,byval path as string)
dim bf as new binaryformatter
dim fs as new IO.filestream(path)
bf.serialize(obj, fs) 'Might have to change the order of these parameters
fs.close
End Class
Public function OpenSavedObject(Byval path as string) as yourClass
dim bf as new binaryformatter
dim fs as new IO.filestream(path)
return bf.deserialize(path)
End Function