Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1187
Share UltraCalendarInfo from MDIParent to child forms
posted

I am trying to share an UltraCalendarInfo instance from and MDI parent form that I can then use from child forms so are all working with the same information.  I have not been successful and your assistance is appreciated.

When I bind the calendar info on the MDI parent form to a datatable, the owners and appointments do not load.  Afterwards I always end up with 1 owner (unassigned) and 0 appointments.  I have checked my datatables and they have proper data in them.  If i bind the same datatables to a calenderinfo on a child form, the owners and appointments load fine, so i'm confused why the instance on the MDI form will not.

 

Code on MDI form does not load owners and appoinments into calender info.

 

Public Class MDIParent1

Private Sub MDIParent1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

DbConnector.CONNECTIONSTRING = mClientSettings.CONNECTIONSTRING

' loads owners and appointments into datatables 

mClientSettings.DATATABLESCACHE.Load(mClientSettings.USER.ID)

' THE FOLLOWING LINE OF CODE DOES NOT LOAD ANY OWNERS AND APPOINTMENTS INTO THE CALENDAR INFO 

' copy of code is below 

BindHelper.BindCalendarInfo(Me.UltraCalendarInfo1)

'ShowNewForm(New frmDayView)

ShowNewForm(New frmAgendaView)

End Sub

Public Sub ShowNewForm(ByVal frm As Form)

frm.MdiParent = Me

frm.Show()

End Sub

End Class

 

 

' THIS IS THE SAME CODE USED TO BIND THE DATATABLES TO THE CALENDAR INFO FOR BOTH THE MDI FORM AND CHILD FORMS

' WORKS FIND ON CHILD FORMS

' DOES NOT WORK ON MDI FORM

Public Class BindHelper

Public Shared Sub BindCalendarInfo(ByRef ci As Infragistics.Win.UltraWinSchedule.UltraCalendarInfo)

ci.Owners.UnassignedOwner.Visible = False

'

' owners

'

With ci.DataBindingsForOwners

.DataSource = Nothing

.KeyMember = "id"

.NameMember = "username"

.EmailAddressMember = "email"

.DataSource = mClientSettings.DATATABLESCACHE.DATASET.Tables("users")

End With

'

' appointments

'

With ci.DataBindingsForAppointments

.DataSource = Nothing

.DataKeyMember = "tempid"

.AllDayEventMember = "alldayflag"

.AllPropertiesMember = "allproperties"

.AllPropertiesMemberSerializationMode = Infragistics.Win.UltraWinSchedule.DateSerializationMode.SerializeDatesAsLocalTime

.DescriptionMember = "description"

.EndDateTimeMember = "date_end"

.OwnerKeyMember = "ownerid"

.ReminderEnabledMember = "reminder_enabled"

.ReminderIntervalMember = "reminder_interval"

.StartDateTimeMember = "date_start"

.SubjectMember = "subject"

.DataSource = mClientSettings.DATATABLESCACHE.DATASET.Tables("traffic_actions")

End With

End Sub

End Class

 

 

' MY CODE ON THE CHILD FORMS

Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Me.UltraDayView1.CalendarLook = DirectCast(Me.MdiParent, MDIParent1).UltraCalendarLook1

Me.UltraMonthViewSingle1.CalendarLook = DirectCast(Me.MdiParent, MDIParent1).UltraCalendarLook1

'  THE FOLLOWING COMMENTED LINE OF CODE WORKS FINE TO SHOW THE OWNERS AND APPOINTMENTS WHEN ON A CHILD FORM

'BindHelper.BindCalendarInfo(Me.UltraCalendarInfo1)

' THE FOLLOWING LINE OF CODE DOES NOT WORK, THE CALENDAR INFO INSTANCE FROM THE MDI FORM DOES NOT HAVE ANY APPOINTMENTS OR OWNERS

Me.UltraCalendarInfo1 = DirectCast(Me.MdiParent, MDIParent1).UltraCalendarInfo1

End Sub

Parents
No Data
Reply
  • 69832
    Offline posted

    The data binding layer needs a binding context, so try setting the CalendarInfo.DataBindingsForAppointments.BindingContextControl property to reference the MDI parent.

Children
No Data