Results 1 to 3 of 3

Thread: Remove custom controls [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Resolved Remove custom controls [RESOLVED]

    hey im trying to remove all my custom controls from my form, but not all of the are removed. i have to call my lear function a few times, depending on the number of controls. All of the controls are created at runtime and have different names.

    Code:
      		private void ClearResults()
      		{
      			foreach(Control c in this.pMain.Controls)
      			{
      				if(c is ResultsItem)
      				{
      #if DEBUG
     		 		Debug.WriteLine("Disposing of " + c.Name.ToString());
      #endif
     					c.Visible = false;
     					c.Dispose();
      				}
      			}
      		}
    Is there a better way to remove the controls from a form?

    Thanks
    Last edited by john tindell; Jan 28th, 2005 at 10:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width