devxlogo

Problems With ActiveX Controls Pasted From Clipboard

Problems With ActiveX Controls Pasted From Clipboard

In VB5, the event is not called when an instance of your UserControl is copied into the clipboard andpasted again, creating a new one. This affects user controls that depend on the UserControl_Resize event todefine the control’s appearance. To check this behavior, start VB5, create a new ActiveX Control project,and add a text box in the middle of your UserControl area. Add this code to the UserControl Resize Event:

 Private Sub UserControl_Resize()        Text1.Move 0, 0, Width, HeightEnd Sub

Close your UserControl and add a Standard EXE project. Create an instance of your new UserControl.You should get a text box filling all your UserControl area. Now copy the UserControl to the clipboard andchoose Paste. Note the new instance of your control doesn’t resize the text box as it should. To workaround this problem, add this code to the UserControl ReadProperties event:

 Sub UserControl_ReadProperties_        (PropBag As PropertyBag)        Call UserControl_ResizeEnd Sub
See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist