0

I asked a question yesterday and for reference: Keeping track of 40+ control values

I am binding a bunch of controls to a property class; however, it really slows down the GUI portion of the application. For example, with the following code:

        numericUpDownPhysicalAIs.DataBindings.Add("Value", configurationValues, "PhysicalAIs");
        numericUpDownInternalAIs.DataBindings.Add("Value", configurationValues, "InteralAIs");
        numericUpDownPhysicalAOs.DataBindings.Add("Value", configurationValues, "PhysicalAOs");
        numericUpDownInternalAOs.DataBindings.Add("Value", configurationValues, "InternalAOs");
        numericUpDownSetpoints.DataBindings.Add("Value", configurationValues, "Setpoints");
        numericUpDownIndexRegisters.DataBindings.Add("Value", configurationValues, "IndexRegisters");
        numericUpDownNetworkID.DataBindings.Add("Value", configurationValues, "NetworkID");
        numericUpDownQuiescentOperationStartupDelay.DataBindings.Add("Value", configurationValues, "QuiescentOperationStartupDelay");
        numericUpDownQuiescentTelemetryTable.DataBindings.Add("Value", configurationValues, "QuiescentTelemetryTableScanRate");
        numericUpDownPercentQuiescentThreshold.DataBindings.Add("Value", configurationValues, "PercentQuiescentThreshold");
        numericUpDownPercentageOfQuiescentInterval.DataBindings.Add("Value", configurationValues, "PercentQuiescentInterval");
        numericUpDownAODayWeek.DataBindings.Add("Value", configurationValues, "AODayWeek");
        numericUpDownAODayMonth.DataBindings.Add("Value", configurationValues, "AODayMonth");
        numericUpDownAOMonthYear.DataBindings.Add("Value", configurationValues, "AOMonthYear");
        numericUpDownAOYear.DataBindings.Add("Value", configurationValues, "AOYear");
        numericUpDownTimeDay.DataBindings.Add("Value", configurationValues, "TimeDay");
        numericUpDownDebugStatementNumberSetpoint.DataBindings.Add("Value", configurationValues, "DebugStatementNumberSetpoint");
        numericUpDownTelemetryControlSetpoint.DataBindings.Add("Value", configurationValues, "TelemetryControlSetpoint");
        numericUpDownCommunicationFailDI.DataBindings.Add("Value", configurationValues, "CommunicationFailDI");
        numericUpDownCommunicationFailAddressAO.DataBindings.Add("Value", configurationValues, "CommunicationFailAddressAO");
        numericUpDownAddressUnreachableAO.DataBindings.Add("Value", configurationValues, "AddressUnreachableUnitAO");
        numericUpDownPowerCountAO.DataBindings.Add("Value", configurationValues, "PowerCountAO");
        numericUpDownResetCountAO.DataBindings.Add("Value", configurationValues, "ResetCountAO");
        numericUpDownRandomNumberAO.DataBindings.Add("Value", configurationValues, "RandomNumberAO"); 

It takes a good 30 seconds to a minute for the form to show up all the numeric up/down boxes. If I comment this code out, the GUI pops up instantly. Is this a limitation of the DataBindings.Add method?

Thanks

Community
  • 1
  • 1
brazc0re
  • 253
  • 4
  • 13
  • Check this out http://stackoverflow.com/questions/2788215/slow-databinding-setup-time-in-c-sharp-net-4-0 – Micah Armantrout Jun 27 '12 at 16:19
  • did you try to disable painting (override OnPaint and do nothing while binding) ? – ralf.w. Jun 27 '12 at 18:31
  • Halting paint operations as ralf.w. suggests can speed things up but I believe the underlying issue here is that databinding uses Reflection, which is inherently slow. – harlam357 Jun 27 '12 at 18:53
  • Thanks for all the replies. After some thought, this might not be the best way for me to approach this problem. While data binding might have made things easier, it seems like a big of a clooje to make it work if I go that route. – brazc0re Jun 27 '12 at 20:13

0 Answers0