using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; namespace myNamespace { // C# // Specifies the bitmap associated with the DataGrid type. // [ToolboxBitmap(typeof(DataGrid))] public partial class grdOrderDetails : DataGrid { private int _rowNumber = 0; public int _RowNumber { get { return this._rowNumber; } set { this._rowNumber = value; } } #region Grid Mouse Up Event /// <summary> /// Search grid mouse up event. /// </summary> protected override void OnMouseUp(MouseEventArgs mea) { base.OnMouseUp(mea); DataGrid.HitTestInfo hti = this.HitTest(mea.X, mea.Y); try { switch (hti.Type) { case DataGrid.HitTestType.Cell: { this.Select(hti.Row); _rowNumber = hti.Row; break; } case DataGrid.HitTestType.ColumnHeader: { break; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } #endregion } }I changed the original DataGrids to the instances of my class in my form and now I'm getting an error in run-time about failing initialize.