Results 1 to 3 of 3

Thread: Save structure to XML file - URGENT PLEASE

  1. #1

    Thread Starter
    New Member helderpinto79's Avatar
    Join Date
    Jun 2007
    Location
    Porto, Portugal
    Posts
    5

    Question 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...

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Save structure to XML file - URGENT PLEASE


  3. #3
    Hyperactive Member cptHotkeys's Avatar
    Join Date
    Apr 2007
    Location
    New Zealand
    Posts
    294

    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

    Signatures suck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width