[]
You can add importing and exporting functionality to your scheduling application using the Import and Export methods. The Import method opens the OpenFileDialog dialog box, allowing you to import an XML or iCal file. The Export method opens the SaveFileDialog dialog box, allowing you to export an XML or iCal file. Additionally, you can manually select or enter *.dat format to open or save files from OpenFileDialog or SaveFileDialog dialog boxes.
type=note
Note: In .NET 9, the binary format (.dat) is not supported, and therefore hidden by default in OpenFileDialog and SaveFileDialog. You can also use built-in importing and exporting features, see Importing and Exporting Data for details.
In the following example, C1Calendar and C1Schedule controls are added to the form along with two buttons named Import and Export. When the application is run, you'll be able to import and export data into the C1Schedule control.
Complete the following steps to add importing and exporting functionality to a scheduling application:
Create a new .NET application.
From the toolbox, drag and drop the C1Calendar, C1Scheduler, and two Buttons onto the form.
In the Properties window, set the Name and Text properties for buttons. In this example code, the Name property of first button is set to "buttonImport" and the Text property to "Import". Similarly, the Name property of second button is set to "buttonExport" and the Text property to "Export".
The below image illustrates the sample layout of the form after placing all the controls:
Double-click the Import button. The Code Editor will open and the buttonImport_Click event will be added. Add the below code to enable importing files:
private void buttonImport_Click(object sender, EventArgs e)
{
c1Schedule1.Import("Import a File");
}
Double-click the Export button. The Code Editor will open and the buttonExport_Click event will be added. Add the below code to enable exporting files:
private void buttonExport_Click(object sender, EventArgs e)
{
c1Schedule1.Export("", "Export a File");
}
The Import and Export buttons will enable you to import and export appointments into your scheduling application. To Import and Export appointments from the application, perform the following tasks: