PC Review


Reply
Thread Tools Rate Thread

Can't close form

 
 
Andy
Guest
Posts: n/a
 
      4th Sep 2003
Hi,
I have a problem with closing a form, when I'm clicking 'x' button,
the form is still visible.
My form has functionality like TabControl. When I add a new control, all
controls are deleted from the form control collection,
(this.Controls.Clear(); this.Controls.Add( c ) ), but old controls aren't
disposed but added to the queue (Private object on the form of
System.Collection.Queue() class).

After adding the new control, I move focus to this control. Property
ActiveControl of the form is set to null. Where may be a problem?

Regards,
Andy


 
Reply With Quote
 
 
 
 
Laurie Paulin
Guest
Posts: n/a
 
      4th Sep 2003
Know bug - if the removed control has the focus, then removing it will keep
the form open. Change the focus to another control before removal.

Laurie Paulin
Perth, Western Australia

"Andy" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi,
> I have a problem with closing a form, when I'm clicking 'x' button,
> the form is still visible.
> My form has functionality like TabControl. When I add a new control, all
> controls are deleted from the form control collection,
> (this.Controls.Clear(); this.Controls.Add( c ) ), but old controls aren't
> disposed but added to the queue (Private object on the form of
> System.Collection.Queue() class).
>
> After adding the new control, I move focus to this control. Property
> ActiveControl of the form is set to null. Where may be a problem?
>
> Regards,
> Andy
>
>



 
Reply With Quote
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      4th Sep 2003
Hi Andy,

The problem is with tricky control removal. You should call the container's
OnControlRemoved protected method before the control has been removed from
the Controls collection, but a reference to the control is still valid.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE


"Andy" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
> I have a problem with closing a form, when I'm clicking 'x' button,
> the form is still visible.
> My form has functionality like TabControl. When I add a new control, all
> controls are deleted from the form control collection,
> (this.Controls.Clear(); this.Controls.Add( c ) ), but old controls aren't
> disposed but added to the queue (Private object on the form of
> System.Collection.Queue() class).
>
> After adding the new control, I move focus to this control. Property
> ActiveControl of the form is set to null. Where may be a problem?
>
> Regards,
> Andy
>
>


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      4th Sep 2003
Hello,

"Andy" <(E-Mail Removed)> schrieb:
> I have a problem with closing a form, when I'm clicking 'x' button,
> the form is still visible.


http://www.jelovic.com/dotnetbugs/index.html

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
100
Guest
Posts: n/a
 
      4th Sep 2003
Hi Dimitry,
Just a little supplement to what you said.
You can call OnControlRemoved before controll removal or after it doesn't
really matter. You have to call OnControlRemoved before disposing the
control, though.

OnControlRemoved has to be called on the ultimate container. If a controls
is placed on a user control, which in turn resides on a form after removing
the controll form's OnControlRemoved has to be called. Otherwise it won't
do.

B\rgds
100

"Dmitriy Lapshin [C# / .NET MVP]" <x-(E-Mail Removed)> wrote
in message news:(E-Mail Removed)...
> Hi Andy,
>
> The problem is with tricky control removal. You should call the

container's
> OnControlRemoved protected method before the control has been removed from
> the Controls collection, but a reference to the control is still valid.
>
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
> http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
>
>
> "Andy" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Hi,
> > I have a problem with closing a form, when I'm clicking 'x' button,
> > the form is still visible.
> > My form has functionality like TabControl. When I add a new control, all
> > controls are deleted from the form control collection,
> > (this.Controls.Clear(); this.Controls.Add( c ) ), but old controls

aren't
> > disposed but added to the queue (Private object on the form of
> > System.Collection.Queue() class).
> >
> > After adding the new control, I move focus to this control. Property
> > ActiveControl of the form is set to null. Where may be a problem?
> >
> > Regards,
> > Andy
> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
docmd.close forms - doesn't close the form Wuelf Microsoft Access Reports 1 18th Nov 2008 01:05 PM
Close button on a form will not close form - error 2585 - action cannot be carried out while processing a form Angus Comber Microsoft Access 2 19th Jul 2006 12:21 PM
Clear Checkbox field on close of form or close of report =?Utf-8?B?QnJvb2s=?= Microsoft Access Form Coding 2 14th Jan 2006 09:31 PM
How to close parent form and not to close a child form also? Viper Microsoft C# .NET 5 15th Oct 2004 08:33 PM
How to close a userform in a forusers, close protected form? De Wilde Eddy Microsoft Excel New Users 1 7th Jun 2004 06:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:02 PM.