3

I'm using a self-authored ActiveX control on an MS Access form. On adding the Active X control, I can set a custom design time property without issue. However, if I go back into design mode to change the value of the design time property, the property change is not retained. Appreciate for guidance on why design time change to custom property is not retained. Is the ActiveX control design missing some required functionality to retain design mode property changes? To recreate the issue:

  1. Using the ActiveX control in C# as per Microsoft sample found at C# ActiveX Control (CsActiveX)

    1. After compiling the sample, open MS Access, add a reference to the CsActiveX.tlb from the C# project.
    2. Add the CsActiveX control (csActiveX.CSActiveXCtrl) to a form and set it's custom 'FloatProperty' to 5. Save the form.
    3. Open form in 'Form View' and the float property is displayed as expected i.e. 5.
    4. Re-open the form in design mode and change the 'FloatProperty' to 8. Save design changes.
    5. Re-open form in 'Form View' but the float property is displayed as 5 and not 8 as expected. i.e. the change in design mode was lost!

Fyi, if I use the ActiveX control in a c# Win Forms application, the control works as expected. Also, I'm inexperienced in ActiveX control design and am using this sample as a base on which to design my own custom controls for use in VBA.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Mike Humphreys
  • 101
  • 1
  • 3
  • do you call `PropertyChanged` where required? [see also here](https://msdn.microsoft.com/en-us/library/aa261325(v=vs.60).aspx) – Cee McSharpface Mar 06 '18 at 09:38
  • 2
    I revisited the documentation in the @dlatikay link above and especially the section on Understand Control Lifetime and Key Events [(see reference here)](https://msdn.microsoft.com/en-us/library/aa733730(v=vs.60).aspx). It would seem that the ActiveX control WriteProperties event is not being fired when the form switches from Design Mode to Runtime mode and when the control is on an Ms Access form design surface. If so, is there something I need to do so that the control is aware of the switch from Design Mode when it's placed on an MS Access form design surface? – Mike Humphreys Mar 07 '18 at 10:30

0 Answers0