Hi,I am using the Ultrawin Sheduler for one of my appointment book feature. In that i have more then 1 owner. I also have a Unassigned owner visible.While binding the Data to the scheduler, things work well. Appointments gets distributed to different owners correctly, even to the unassigned owner. Drag and Drop from the Unassigned to the Proper owner also works well.But Drag and Drop from proper owners to Unassigned owner throws up following exception:System.ArgumentException occurred Message="Object of type 'System.DBNull' cannot be converted to type 'System.String'." Source="System" StackTrace: at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value) at Infragistics.Win.UltraWinSchedule.Appointment.BoundPropertySet(AppointmentsDataBindingPropertyId currentPropertyId, Object newValue, AppointmentPropIds undirtyPropertyId, Boolean updateForUnboundMember) at Infragistics.Win.UltraWinSchedule.Appointment.BoundPropertySet(AppointmentsDataBindingPropertyId currentPropertyId, Object newValue, AppointmentPropIds undirtyPropertyId) at Infragistics.Win.UltraWinSchedule.Appointment.set_OwnerKey(String value) at Infragistics.Win.UltraWinSchedule.Appointment.InternalSetOwner(Owner newOwner) at Infragistics.Win.UltraWinSchedule.Appointment.set_Owner(Owner value) at Infragistics.Win.UltraWinSchedule.UltraDayView.DragAppointmentsToTimeSlot(MouseMessageInfo msginfo) at Infragistics.Win.UltraWinSchedule.UltraDayView.DragAppointments(MouseMessageInfo msginfo) at Infragistics.Win.UltraWinSchedule.UltraDayView.Infragistics.Win.ISelectionManager.OnDragMove(MouseMessageInfo& msginfo) at Infragistics.Win.SelectionStrategyBase.DragMove(MouseMessageInfo msgInfo) at Infragistics.Win.SelectionStrategyExtended.OnMouseMove(ISelectableItem item, MouseMessageInfo& msginfo) at Infragistics.Win.SelectionStrategyExtended.OnMouseMessage(ISelectableItem item, MouseMessageInfo& msginfo) at Infragistics.Win.ControlUIElementBase.ProcessMouseMoveHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseMove(Object sender, MouseEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnMouseMove(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseMove(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at EasyClinic.UI.MdlStartUp.Main(String[] Switch) in Y:\Easy Clinic Application\EasyClinic\EasyClinic_UI\Startup Objects\MdlStartUp.vb:line 169Following is the code that i am using to bind the owners to the scheduler: With Frm.UltraCalendarInfo1.DataBindingsForOwners .DataSource = ObjOwnerCol .BindingContextControl = Frm .KeyMember = Code .NameMember = FullName .VisibleMember = IsVisible End With 'Bind the datasource to the scheduler With Frm.UltraCalendarInfo1.DataBindingsForAppointments .DataSource = ObjAppointmentsCol .BindingContextControl = Frm .SubjectMember = Subject .StartDateTimeMember = StartTime .AllDayEventMember = IsAllDayEvent .EndDateTimeMember = EndTime .OwnerKeyMember = OwnerCode End WithCan you please tell me where am i going wrong?Regards,Hemesh
The string field you are using for the owner key has a "disallow null" condition imposed on it, and the database layer is rejecting the null value.
Thanks for the reply Brian.
Regarding to the first point of your reply, do you mean that 'disallow null' condition is imposed in our Propertties, which is throwing the exception. Its a normal String property at our end, which is not causing any problem. Is there a way to allow nulls ?
And about the 2nd point, this exception is coming right at the time of Dragging an Appointment into an Unassigned column. Even the BeforeAppointmentOwnerChanged event doesn't fire for Unassigned owner, so the question of the Database Layer coming into the picture is also not there.
Sorry, I made an assumption about the use of a DataSet here since you didn't mention what the Appointments/Owners collection were bound to and most people bind to a DataSet or DataTable. A "normal" string property will reject values other than type string and null, so you would have to make the property setter somehow accept assignments of type System.DbNull. One way to do this would be to use the object type, or you could also create a custom type that accepts string, null, and DbNull.
There is no 'BeforeAppointmentOwnerChanged' event so I was not clear on exactly what you were describing in the second paragraph, but when you drag an appointment to a different Owner the OwnerKey property of the Appointment is assigned the new value, and this is what starts the chain of events that ends with the exception.