Click here to Skip to main content
15,892,927 members
Articles / Programming Languages / C#

Drill-down Combo Control

Rate me:
Please Sign up or sign in to vote.
4.57/5 (22 votes)
22 Dec 20056 min read 148.6K   1.3K   94  
A flexible drill-down combo control supporting hierarchical, cascading selections.
/*
 * Created by SharpDevelop.
 * User: Ken
 * Date: 7/08/2004
 * Time: 10:27 AM
 */

using System;
using System.Collections;
using System.Windows.Forms;

namespace OMC.DrillDown
{
  [Serializable()]
  public class CategoryComboCollection : CollectionBase 
  {
		
    #region CollectionBase

    public CategoryComboCollection()
    {
    }
		
    public CategoryComboCollection(CategoryComboCollection val)
    {
      this.AddRange(val);
    }
		
    public CategoryComboCollection(CategoryCombo[] val)
    {
      this.AddRange(val);
    }
		
    public CategoryCombo this[int index] 
    {
      get 
      {
        return ((CategoryCombo)(List[index]));
      }
      set 
      {
        List[index] = value;
      }
    }
		
    public int Add(CategoryCombo val)
    {
      return List.Add(val);
    }
		
    public void AddRange(CategoryCombo[] val)
    {
      for (int i = 0; i < val.Length; i++) 
      {
        this.Add(val[i]);
      }
    }
		
    public void AddRange(CategoryComboCollection val)
    {
      for (int i = 0; i < val.Count; i++)
      {
        this.Add(val[i]);
      }
    }
		
    public bool Contains(CategoryCombo val)
    {
      return List.Contains(val);
    }
		
    public void CopyTo(CategoryCombo[] array, int index)
    {
      List.CopyTo(array, index);
    }
		
    public int IndexOf(CategoryCombo val)
    {
      return List.IndexOf(val);
    }
		
    public void Insert(int index, CategoryCombo val)
    {
      List.Insert(index, val);
    }
		
    public new CategoryComboEnumerator GetEnumerator()
    {
      return new CategoryComboEnumerator(this);
    }
		
    public void Remove(CategoryCombo val)
    {
      List.Remove(val);
    }
		
    #endregion

  }

  [Serializable()]
  public class CategoryComboEnumerator : IEnumerator
  {

    #region IEnumerator
			
    IEnumerator baseEnumerator;
    IEnumerable temp;
			
    public CategoryComboEnumerator(CategoryComboCollection mappings)
    {
      this.temp = ((IEnumerable)(mappings));
      this.baseEnumerator = temp.GetEnumerator();
    }
			
    public CategoryCombo Current 
    {
      get 
      {
        return ((CategoryCombo)(baseEnumerator.Current));
      }
    }
			
    object IEnumerator.Current 
    {
      get 
      {
        return baseEnumerator.Current;
      }
    }
			
    public bool MoveNext()
    {
      return baseEnumerator.MoveNext();
    }
			
    bool IEnumerator.MoveNext()
    {
      return baseEnumerator.MoveNext();
    }
			
    public void Reset()
    {
      baseEnumerator.Reset();
    }
			
    void IEnumerator.Reset()
    {
      baseEnumerator.Reset();
    }

    #endregion

  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Engineer
Australia Australia
Ken is a mechanical engineer with an interest in programming in .NET.

Comments and Discussions