• Saving and Loading Appointments from a stream [Janus GridEX WinForms Control v3.5 for .NET]

    This tutorial is intended to show you how to save and load the Appointments, Fields and Owners collections from a stream.



    The steps followed to create this project were:



    1) Create a new Visual Basic or C# project using "Windows Application" Template



    2) Add a Schedule control to Form1.



    3) Add a Calendar control and bind it to the Schedule control.



    4) Add a button and change its Text property to "Save"



    5) In the Click event of the save button use the SaveAppointments method to save the appointments to a file.



    In C#



    this.Cursor = Cursors.WaitCursor;

    string appointmentsDir = @"C:\Appointments.xml";

    System.IO.FileStream appointmentsStream;

    appointmentsStream = new System.IO.FileStream(appointmentsDir, System.IO.FileMode.Create);

    schedule1.SaveAppointments(appointmentsStream);

    appointmentsStream.Close();

    this.Cursor = Cursors.Default;





    In VB



    Me.Cursor = Cursors.WaitCursor

    Dim appointmentsDir As String = "C:\Appointments.xml"

    Dim appointmentsStream As System.IO.FileStream

    appointmentsStream = New System.IO.FileStream(appointmentsDir, System.IO.FileMode.Create)

    Schedule1.SaveAppointments(appointmentsStream)

    appointmentsStream.Close()

    Me.Cursor = Cursors.Default



    6) Add a button and change its Text property to "Load"



    7) In the Click event of the load button, use the LoadAppointments method of the Schedule to load the appointment from a file



    In VB



    Me.Cursor = Cursors.WaitCursor

    Dim AppointmentsDir As String = "C:\Appointments.xml"

    Dim AppointmentsStream As System.IO.FileStream

    AppointmentsStream = New System.IO.FileStream(AppointmentsDir, System.IO.FileMode.Open)

    Schedule1.LoadAppointments(AppointmentsStream)

    AppointmentsStream.Close()

    Me.Cursor = Cursors.Default

    In C#



    this.Cursor = Cursors.WaitCursor;

    string appointmentsDir = @"C:\Appointments.xml";

    System.IO.FileStream appointmentsStream;

    appointmentsStream = new System.IO.FileStream(appointmentsDir, System.IO.FileMode.Open);

    schedule1.LoadAppointments(appointmentsStream);

    appointmentsStream.Close();

    this.Cursor = Cursors.Default;


    8) Run the project.

    Source Of Information : Janus v3.5 Help Files for VS 2008


0 comments:

Leave a Reply