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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UserControl causing error, trying to close parent form with event

Status
Not open for further replies.

DarkMercenary44

Technical User
May 19, 2000
55
US
Alright, I'm creating a control that will make a borderless form look like that of a form in Microsoft Project 2000, and Microsoft Visio 2000. I've got everything to work, but one thing.

I have the 3 buttons on the top of the form, Minimize, Maximize and Close (these are actually in the control) I've tried to make it so that if a user clicks the close button it will close the parent form, so I did something like this
Code:
(In the Usercontrol)
Private Sub ExitButtonClick()
     Unload UserControl.Parent
End Sub

That generates the error too. I then tried to set it up so that when the user clicks the close button it fires an event in the usercontrol called CloseButtonClicked(). Here is the code I tried to put into the Form that contained the control

Code:
(In Form that containes Control)
Private Sub UserControl11_CloseButtonClicked()
     Unload Me 
End Sub

Have also tried Unload Form1

If I but a normal command button in the form and set it to unload me, then it works fine, also works fine if I create another form with my control inside of it it and set the CloseButtonClicked Instructions to close the first form. I get errors every time I try to close the form that contains my usercontrol if another one isn't open already.

PLLLEeEEEEAAAASSE Help....If required I'll send you the code.

P.S. Does it matter if the three buttons are activeX controls themselves, can one activeX control contain another? DarkMercenary
darkmercenary44@earthlink.net

In the real world
As in dreams
Nothing is quite
What it seems
:Book of Counted Sorrows
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top