Imports Infragistics.Win.UltraWinSchedule
Imports System.IO
...
Private Sub SaveAppointments()
' Create a new FileStream in the same folder with the EXE
Dim SaveFileStream As New IO.FileStream("Appointments.sav", IO.FileMode.OpenOrCreate)
' Move to the beginning of the FileStream
SaveFileStream.Position = 0
' Save the CalendarInfo
Me.UltraCalendarInfo1.Save(SaveFileStream, CalendarInfoCategories.Appointments)
' Close the FileStream
SaveFileStream.Close()
End Sub
Private Sub LoadAppointments()
Dim LoadFileStream As IO.FileStream = Nothing
Try
' Try to load FileStream
LoadFileStream = _
New IO.FileStream(System.IO.Path.Combine(Application.StartupPath(), _
"Appointments.sav"), IO.FileMode.Open)
Catch When LoadFileStream Is Nothing
' If the FileStream fails to load, it's probably because the file does not exist
MsgBox("Error opening Appointments file. The file may not exist", _
MsgBoxStyle.OKOnly, "Error")
Exit Sub
End Try
' Move to the beginning of the FileStream
LoadFileStream.Position = 0
' Load the FileStream
Me.UltraCalendarInfo1.Load(LoadFileStream, CalendarInfoCategories.Appointments)
' Close the FileStream
LoadFileStream.Close()
End Sub