Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Boxes

Status
Not open for further replies.

capone67

Programmer
Nov 6, 2000
115
CA
Hi Gang

I m still working on my activeX controls. I finally figured out how to get them to download properly. Now I am working onmaking the things run quicker and look better. Does anyone know of a way to create more colourful message boxes. The grey msgbox is not very pretty.

Ken
 
Thanks Simon

I thought ActiveX wouldnt let you pop up a form? I tried a couple of form controls I found online and neither one worked. Maybe I did something wrong?

At this point in time I don't want to invest much time in colourful message boxes. Guess I will let it be for now.

Ken
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top