I get an System.IO.FileN otFoundExceptio n when trying to serialize data.
The "not found file" is a random name .dll
after doing some Google, if found this article:
http://weblogs.asp.net/cschittko/articles/33045.aspx
I am not expirenced enough to do the testing, which is described there.
But according to it, maybe my XmlSerializer can't serialize my data.
I took the code from a book and I thought it should work.
here is the code:
=============== =============== ===========
Public Enum purchaseOrderSt ates
ISSUED
DELIVERED
INVOICED
PAID
End Enum
<Serializable() > _
Public Class company
Public name As String
Public address As String
Public phone As String
End Class
<Serializable() > _
Public Class lineItem
Public description As String
Public quantity As Integer
Public cost As Double
End Class
<Serializable() > _
Public Class purchaseOrder
Private _purchaseOrderS tatus As purchaseOrderSt ates
Private _issuanceDate As DateTime
Private _deliveryDate As DateTime
Private _invoiceDate As DateTime
Private _paymentDate As DateTime
Public buyer As company
Public vendor As company
Public reference As String
Public items() As lineItem
Public Sub New()
_purchaseOrderS tatus = purchaseOrderSt ates.ISSUED
_issuanceDate = DateTime.Now
End Sub
Public Sub recordDelivery( )
If _purchaseOrderS tatus = purchaseOrderSt ates.ISSUED Then
_purchaseOrderS tatus = purchaseOrderSt ates.DELIVERED
_deliveryDate = DateTime.Now
End If
End Sub
Public Sub recordInvoice()
If _purchaseOrderS tatus = purchaseOrderSt ates.DELIVERED
Then
_purchaseOrderS tatus = purchaseOrderSt ates.INVOICED
_invoiceDate = DateTime.Now
End If
End Sub
Public Sub recordPayment()
If _purchaseOrderS tatus = purchaseOrderSt ates.INVOICED Then
_purchaseOrderS tatus = purchaseOrderSt ates.PAID
_invoiceDate = DateTime.Now
End If
End Sub
End Class
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim Vendor As company = New company
Dim Buyer As company = New company
Dim Goods As lineItem = New lineItem
Dim po As purchaseOrder = New purchaseOrder
Vendor.name = "Acme Inc."
Buyer.name = "Wiley E. Coyote"
Goods.descripti on = "anti-RoadRunner cannon"
Goods.quantity = 1
Goods.cost = 599.99
po.items = New lineItem(1) {}
po.items(0) = Goods
po.buyer = Buyer
po.vendor = Vendor
Dim xs As XmlSerializer = New XmlSerializer(p o.GetType())
Dim fs As FileStream = File.Create("C: \po.xml")
xs.Serialize(fs , po)
fs.Close()
End Sub