I am trying to bind an UltraCalendar control to a binding source and am having problems. When I go into the custom property pages to set all the properties, I get errors when I try to pick a binding source as my data source. More specifically, I get the errors when I try to pick the Data Member on a binding source. I have no problems if I bind directly to a typed dataset that is on the form, but I would prefer to use a binding source so I can filter the data. Should I be able to use a binding source for this control?
Yes, you should be able to use a BindingSource. It might help here to know exactly what the error message says.
Here's what I have:
A strongly-typed dataset on my form with two datatables in it -- one for Owners and one for Appointments. There is a relation between the two tables on the Owner_ID
Two binding sources on the form. The DataSource for each is the dataset and the DataMember is set to either the Owners table or the Appointments table.
I set the properties of the Schedule info control for Owners by setting his DataSource property to the binding source for owners and the Appointments DataSource property to the binding source for appointments. I then set all of the members to their matching fields in the datatables.
When I run, I get the following error: "The following error has occurred: In current data source there is no column named: All_Day_Event"
Keep in mind that I was able to pick this column in the custom property pages of the control and I can confirm that it is indeed in the Appointments datatable. A screen capture is attached.
I don't really spend much time using designers if I can help it so I've never seen this, but I think what might be happening is, when the form initializes, the AllDayEventMember property is probably getting set before the data source is, hence making the data binding layer think there is no such column. If that is the case it is a bug, which you might want to report.
You would be able to work around this by not setting the AllDayEventMember property (or any other of the '*Member' properties) until after the InitializeComponent method has completed execution, say, for example, in response to the Form's Load event.
Excellent tip, Brian! That did the trick for me. I moved all the code to a sub from the designer and now it works perfectly.