Items collection cannot be modified when the DataSource property is set

Stimulsoft Reports.NET discussion
Post Reply
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Items collection cannot be modified when the DataSource property is set

Post by Brendan »

Hi.

Attached is a Report template that causes the following runtime exception to occur

"Items collection cannot be modified when the DataSource property is set"

Stack Trace:
************** Exception Text **************
System.ArgumentException: Items collection cannot be modified when the DataSource property is set.
at System.Windows.Forms.ComboBox.CheckNoDataSource()
at System.Windows.Forms.ComboBox.ObjectCollection.Clear()
at Stimulsoft.Report.Dialogs.StiWinDialogsProvider.OnReportControlUpdate(Object sender, StiReportControlUpdateEventArgs e)
at Stimulsoft.Report.Dialogs.StiForm.InvokeReportControlUpdate(Object sender, StiReportControlUpdateEventArgs e)
at Stimulsoft.Report.Dialogs.StiReportControl.UpdateReportControl(String propertyName)
at Stimulsoft.Report.Dialogs.StiComboBoxControl.OnCollectionChanged(Object sender, EventArgs e)
at Stimulsoft.Report.Dialogs.StiArrayList.InvokeCollectionChanged()
at Stimulsoft.Report.Dialogs.StiArrayList.Clear()
at Stimulsoft.Report.Dialogs.StiWinDialogsProvider.ConvertComboBoxToReportControl(StiComboBoxControl comboBoxControl, ComboBox comboBox)
at Stimulsoft.Report.Dialogs.StiWinDialogsProvider.ConvertControlsToDialogs(Control parentControl, StiReportControl control)
at Stimulsoft.Report.Dialogs.StiWinDialogsProvider.FormToReportControl(StiForm formControl)
at Stimulsoft.Report.Dialogs.StiWinDialogsProvider.OnLeave(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnLeave(EventArgs e)
at System.Windows.Forms.Control.NotifyLeave()
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()

Tested with 2009.3.0.0 and 2010.1.0.0 builds.
Retested with 2009.1.0.0 and worked ok without errors in this build.

Simple Form with Report page.
The problem seems to stem from the numericUpDown controls.
The Report template has 4 fields to specify values. 2 NumericUpDown controls and two combo boxes.
The First combo box has no DataSource and just uses its Items property.
The Second combo box has a DataTable bound to its Control.DataSource via the FormLoad event.

Scenario 1:
Run report through preview.
Type a number into the NumericUpDown control and press tab.
Strange behaviour occurs and all values from combo box 1 also get cleared.


Scenario 2:
Open Form1 in the designer, Select the form, Events and uncomment the calling function for its Form Load Event.
Run report through preview
Type a number into the NumericUpDown control and press teb
[Exception Occurs] "Items collection cannot be modified when the DataSource property is set" from combo box 2.
Also combo box 1 values are lost.



The issue does not seem to occur when the spin buttons on the numeric control are used. Only when the user enters a value in the numeric editor controls and then presses TAB

Thanks.
Attachments
409.FormReportError.mrt
(13.39 KiB) Downloaded 274 times
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Items collection cannot be modified when the DataSource property is set

Post by Jan »

Hello Brendan,

Thank you for your detailed explanation of this problems. All problems fixed. Patch will be included in next prerelease build.

Thank you.
Post Reply