Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclassing MM more questions
Message
 
To
23/06/2004 15:31:19
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00916588
Message ID:
00916602
Views:
6
Thanks Bonnie,

To go along with that question, I have another.

if I create a new component, it adds the following line :
private System.ComponentModel.Container components = null;
If I am subclassing from the MM framework which already has this line, do I need to have it as well, same with the method call or can I shorten the whole thing to just a class define and a empty constructor.

Example a textbox (mine) and MM is below (Proprietary code removed.):
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Data;
using System.IO;
using System.Windows.Forms;

using OakLeaf.MM.Main.Windows.Forms;

namespace Apps4U.Windows.Forms
{
	/// <summary>
	/// Summary description for a4uTextBox.
	/// </summary>
	public class a4uTextBox : mmTextBox
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
---->		private System.ComponentModel.Container components = null;

		public a4uTextBox(System.ComponentModel.IContainer container)
		{
			///
			/// Required for Windows.Forms Class Composition Designer support
			///
			container.Add(this);
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		public a4uTextBox()
		{
			///
			/// Required for Windows.Forms Class Composition Designer support
			///
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}


		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			components = new System.ComponentModel.Container();
		}
		#endregion
	}
}
MM
// Copyright, 2002 Oak Leaf Enterprises Solution Design, Inc.
// No part of this software or its associated documentation 
// may be stored in a retrieval system, copied, transmitted, 
// distributed, transcribed or reproduced in any other way or 
// disclosed to any third parties without the written permission 
// of Oak Leaf Enterprises Solution Design, Inc.

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Data;
using System.IO;
using System.Windows.Forms;

using OakLeaf.MM.Main.Business;
using OakLeaf.MM.Main.Builders;
using OakLeaf.MM.Main.Security;

namespace OakLeaf.MM.Main.Windows.Forms
{
	/// <summary>
	/// Summary description for mmTextBox.
	/// </summary>
	[ToolboxBitmap(typeof(TextBox)),
	DefaultProperty("Name")]
	public class mmTextBox : TextBox, ImmBindingSimple, ImmUISecurity
	{
		/// <summary> 
		/// Required designer variable.
		/// </summary>
--->		private System.ComponentModel.Container components = null;

		/// <summary>
		/// Constructor
		/// </summary>
		public mmTextBox()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
		}

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		/// <summary>
		/// Override the Text property so the class name isn't
		/// automatically stored in the text property when 
		/// an mmTextbox is dropped on a form
		/// </summary>

--->		#region Component Designer generated code
		/// <summary> 
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{

		}
		#endregion

		#region ImmUISecurity Members
		#endregion

		#region ImmSecurityBase Members
		#endregion

		#region ImmBindingSimple Members
		#endregion

		#region ImmBinding Members
		#endregion

		#region ImmBindingBase Members
		#endregion
	}
}
Shawn Dorion
Geo Sektor Dot Com
Website: http://www.geosektor.com

Web Hosting Plans
Visit : http://WebHosting.Applications4u.com/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform