DataGridViewControlCollection.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewControlCollection.cs / 1 / DataGridViewControlCollection.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

using System.Collections; 
using System.Runtime.InteropServices; 
using System.Diagnostics.CodeAnalysis;
 
namespace System.Windows.Forms
{
    public partial class DataGridView
    { 
        /// 
        [ 
            ComVisible(false), 
            SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")    // Consider adding an IList implementation
        ] 
        public class DataGridViewControlCollection : Control.ControlCollection
        {
            DataGridView owner;
 
            /// 
            public DataGridViewControlCollection(DataGridView owner) 
                : base(owner) 
            {
                this.owner = owner; 
            }

            /// 
            public void CopyTo(Control[] array, int index) 
            {
                base.CopyTo(array, index); 
            } 

            ///  
            public void Insert(int index, Control value)
            {
                ((IList)this).Insert(index, (object)value);
            } 

            ///  
            public override void Remove(Control value) 
            {
                if (value != owner.horizScrollBar && value != owner.vertScrollBar && value != this.owner.editingPanel) 
                {
                    base.Remove(value);
                }
            } 

            internal void RemoveInternal(Control value) 
            { 
                base.Remove(value);
            } 

            /// 
            public override void Clear()
            { 
                for (int i = 0; i < this.Count; i++)
                { 
                    if (this[i] == this.owner.horizScrollBar || this[i] == this.owner.vertScrollBar || this[i] == this.owner.editingPanel) 
                    {
                        continue; 
                    }
                    else
                    {
                        Remove(this[i]); 
                    }
                } 
            } 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

using System.Collections; 
using System.Runtime.InteropServices; 
using System.Diagnostics.CodeAnalysis;
 
namespace System.Windows.Forms
{
    public partial class DataGridView
    { 
        /// 
        [ 
            ComVisible(false), 
            SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")    // Consider adding an IList implementation
        ] 
        public class DataGridViewControlCollection : Control.ControlCollection
        {
            DataGridView owner;
 
            /// 
            public DataGridViewControlCollection(DataGridView owner) 
                : base(owner) 
            {
                this.owner = owner; 
            }

            /// 
            public void CopyTo(Control[] array, int index) 
            {
                base.CopyTo(array, index); 
            } 

            ///  
            public void Insert(int index, Control value)
            {
                ((IList)this).Insert(index, (object)value);
            } 

            ///  
            public override void Remove(Control value) 
            {
                if (value != owner.horizScrollBar && value != owner.vertScrollBar && value != this.owner.editingPanel) 
                {
                    base.Remove(value);
                }
            } 

            internal void RemoveInternal(Control value) 
            { 
                base.Remove(value);
            } 

            /// 
            public override void Clear()
            { 
                for (int i = 0; i < this.Count; i++)
                { 
                    if (this[i] == this.owner.horizScrollBar || this[i] == this.owner.vertScrollBar || this[i] == this.owner.editingPanel) 
                    {
                        continue; 
                    }
                    else
                    {
                        Remove(this[i]); 
                    }
                } 
            } 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.

                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK