We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Schedule Control with SQLite in VB

Thread ID:





143754 Apr 3,2019 11:48 PM UTC May 14,2019 11:56 AM UTC WinForms 5
Tags: ScheduleControl
Marco Antonio
Asked On April 3, 2019 11:48 PM UTC


I'm doing a project in WinForms and Visual Basic.
Is there any way to use Schedule Control getting data from a SQLite database?
I have read a similar question, but they use MySQL and C # language, in addition to using a DataProvider class, but in C #, I'm doing my project in Visual Basic.
Could you please help me?


Deivaselvan Y [Syncfusion]
Replied On April 5, 2019 12:46 PM UTC

Hi Marco, 

Thanks for using Syncfusion products. 

By default, Schedule control does not have the direct support to bind the data from DB. If you want to generate the appointment based on the DB data, you can create the appointment based on the DB data using StartTime, EndTime and Subject property in SimpleSheduleDataProvider. Please refer to the below code example,  
Dim scheduleProvider As SimpleScheduleDataProvider = New SimpleScheduleDataProvider() 
scheduleControl1.DataSource = scheduleProvider 
Public Class SimpleScheduleDataProvider 
                                Inherits ScheduleDataProvider 
    Private dset As New DataSet() 
    Private Shared dt As New DataTable() 
    Public Sub New() 
                dt = dset.Tables("MasterList") 
End Sub 
Public Shared Function InitializeRandomData() As SimpleScheduleAppointmentList 
                'int tc = Environment.TickCount; 
                'int tc = 26260100;// simple spread  
                Dim tc As Integer = 28882701 ' split the appointment across midnight & 3 items at 8am on 2 days ago 
                'Console.WriteLine("Random seed: {0}", tc); 
                Dim r As New Random(tc) 
                Dim r1 As New Random(tc) 
                ' set the number of sample items you want in this list. 
                'int count = r.Next(20) + 4; 
                Dim count As Integer = dt.Rows.Count '1000;//200;//30; 
                Dim masterList As New SimpleScheduleAppointmentList() 
                Dim now As DateTime = DateTime.Now.Date 
                For i As Integer = 0 To count - 1 
                                Dim item As ScheduleAppointment = TryCast(masterList.NewScheduleAppointment(), ScheduleAppointment) 
                                Dim dayOffSet As Integer = 30 - r.Next(60) 
                                Dim hourOffSet As Integer = 24 - r.Next(48) 
                                Dim len As Integer = 30 * (r.Next(4) + 1) 
                                item.StartTime = DateTime.Now.AddDays(i) 'Convert.ToDateTime(dt.Rows[i]["StartTime"]); 
                                item.EndTime = DateTime.Now.AddDays(i) 'Convert.ToDateTime(dt.Rows[i]["EndTime"]); 
                                item.Subject = dt.Rows(i)("Subject").ToString() 
                                item.Content = dt.Rows(i)("Content").ToString() 
                                item.LabelValue = Convert.ToInt16(dt.Rows(i)("LabelValue")) 
                                item.LocationValue = dt.Rows(i)("LocationValue").ToString() 
                                item.MarkerValue = (Convert.ToInt16(dt.Rows(i)("MarkerValue"))) 
                                item.Dirty = False 
                Next i 
                Return masterList 
  End Function 
End Class 
Please get back to us if you need any further assistance on this. 

Marco Antonio
Replied On May 8, 2019 04:05 PM UTC

Hi! and thanks for answer.

I was able to make the connection without problem, following the example that was provided. Thank you!

I only have two more questions; how can I restrict the edition of the calendar when I click it (New, Edit, etc)?
And also, how can I customize the control so that by clicking on a calendar item it shows a custom form made by me and not the default form?

I've been looking at the documentation but I have not found those functions.
Thanks for your help!

Sabaridass Ramamoorthy [Syncfusion]
Replied On May 9, 2019 06:50 AM UTC

Hi Marco, 

Thanks for your update. 

To handle the default appointment form and use the custom form to add the appointment in ScheduleControl, you could handle the ShowingAppointmentForm event. Please refer the following code example and the KB link, 

AppointmentForm form; 
//Hook the event for showing the appointment form. 
this.scheduleControl1.ShowingAppointmentForm += scheduleControl1_ShowingAppointmentForm; 
/// <summary> 
/// Raise the event when showing the appointment form 
/// </summary> 
void scheduleControl1_ShowingAppointmentForm(object sender, ShowingAppointFormEventArgs e) 
   //Cancel the default appointment form for schedule control. 
    e.Cancel = true; 
    //Shows the Custom appointment form. 

Sabaridass R 

Marco Antonio
Replied On May 13, 2019 04:21 PM UTC

Hi again!

Thanks for your support.

One more thing.
How can I disable the context menu that appears when I right click on the ScheduleControl? (Image in the attached file)

What I want to do is that the user can not create a New Event, Edit or Delete from that menu.

Attachment: Captura_383fc483.zip

Jagadeesan Pichaimuthu [Syncfusion]
Replied On May 14, 2019 11:56 AM UTC

Hi Marco, 
Thanks for your update. 
To disable the default ContextMenu for ScheduleControl, you could handle the SetupContextMenu event. Please refer the following code example and the sample. 
AddHandler scheduleControl1.SetupContextMenu, AddressOfscheduleControl1_SetupContextmenu 
Private Sub scheduleControl1_SetupContextmenu(sender As Object, e AsCancelEventArgs) 
    e.Cancel = True 
End Sub 
This event should be wire before that assigning the datasource for ScheduleControl. 
Please get back to us if you need any further assistance on this. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon