hi,
i got an error "Illegal Character Path"
my code as follows
i got an error "Illegal Character Path"
my code as follows
Code:
Imports System.IO
Imports System.Xml.Serialization
Public Class serializabledata
Public Function save(ByVal filename As String)
Dim tempFilename As String
tempFilename = filename & "*.tmp"
Dim tempFileInfo1 As FileInfo
Try
tempFileInfo1 = New FileInfo(tempFilename)---------------illegal character path
Catch e As Exception
MsgBox(e.Message) ----------
End Try
'If tempFileInfo1.Exists = True Then
' tempFileInfo1.Delete()
'End If
Dim stream As FileStream
Try
stream = New FileStream(tempFilename, FileMode.Create)---error: illegal character path
Catch e As Exception
MsgBox(e.Message)
End Try
save(stream)
stream.Close()
tempFileInfo1.CopyTo(filename, True)
tempFileInfo1.Delete()
End Function
Public Function save(ByVal stream As Stream)
Dim serializer As New XmlSerializer(Me.GetType)
serializer.Serialize(stream, Me)
End Function
End Class