There is nothing special in the code below, but it does illustrate how you can have a popup form in an ActiveX Control:
1. Start a new ActiveX Control.
2. Change the name of the control to ctlError.
3. Add to the designer a command button.
4. Add to the project a normal form.
5. Rename the form to frmError.
6. Add a command button to frmError.
7. Add a label to frmError and rename to lblError.
8. Add the code below to the control.
Option Explicit
Dim msErrorCaption As String
Public Property Let Error_Caption(sData As String)
msErrorCaption = sData
End Property
Public Sub ShowError()
Dim frm As frmError
Set frm = New frmError
frm.Show
frm.lblError.Caption = msErrorCaption
frm.Refresh
End Sub
Private Sub Command1_Click()
Call ShowError
End Sub
9. Add the code below to the form.
Option Explicit
Private Sub Command1_Click()
Unload Me
End Sub
10. Add a normal exe project.
11. Set the normal exe project to be the start up project.
12. Close the designer for the control.
13. Add the new control to the form in the standard exe project.
14. Add the code below to the form in the standard exe project.
Option Explicit
Private Sub Form_Load()
ctlError1.Error_Caption = "This is the error"
End Sub
15. Run the code.
16. Click on the button on the form.
You should get a popup window.
In executing the program, you are using the control to show a popup form. (Repeated clicking of the button on the original form - in the standard exe - will bring up more "error" messages)
Simon