In this step, you start by configuring a data source to your project and then adding code to synchronize data with the GanttView control.
Visual Basic |
Copy Code
|
---|---|
Imports C1.Win.C1GanttView Public Class Form1 Public Sub New() InitializeComponent() End Sub Private Sub LoadData() Try Me.TasksTableAdapter.Fill(Me.C1NWindDataSet.Tasks) Me.ResourcesTableAdapter.Fill(Me.C1NWindDataSet.Resources) Me.PropertiesTableAdapter.Fill(Me.C1NWindDataSet.Properties) Me.CalendarsTableAdapter.Fill(Me.C1NWindDataSet.Calendars) Catch ex As Exception MessageBox.Show(ex.ToString) End Try End Sub Private Sub SaveData() Try Me.TasksTableAdapter.Update(C1NWindDataSet.Tasks) Me.ResourcesTableAdapter.Update(C1NWindDataSet.Resources) Me.PropertiesTableAdapter.Update(C1NWindDataSet.Properties) Me.CalendarsTableAdapter.Update(C1NWindDataSet.Calendars) Catch ex As Exception End Try End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load LoadData() End Sub Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing SaveData() End Sub End Class |
C# |
Copy Code
|
---|---|
public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void LoadData() { try { this.tasksTableAdapter.Fill(this.c1NWindDataSet.Tasks); this.resourcesTableAdapter.Fill(this.c1NWindDataSet.Resources); this.propertiesTableAdapter.Fill(this.c1NWindDataSet.Properties); this.calendarsTableAdapter.Fill(this.c1NWindDataSet.Calendars); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void SaveData() { try { this.tasksTableAdapter.Update(c1NWindDataSet.Tasks); this.resourcesTableAdapter.Update(c1NWindDataSet.Resources); this.propertiesTableAdapter.Update(c1NWindDataSet.Properties); this.calendarsTableAdapter.Update(c1NWindDataSet.Calendars); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void Form1_Load(object sender, EventArgs e) { LoadData(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { SaveData(); } } |
With this, you have configured C1NWind.mdb database to your project and added code to synchronize the data in both the directions.