Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with AddRange and DataGridView
Message
 
To
04/02/2009 17:54:40
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01378089
Message ID:
01379398
Views:
23
Hi Bonnie, this should be enough code for you
       private BCCI.Controls.PJKBaseDataGridView pjkBaseDataGridView1;
        private BCCI.Controls.PJKBaseDataGridViewTextBoxColumn Column1;
        private BCCI.Controls.PJKBaseDataGridViewTextBoxColumn Column2;
        private BCCI.Controls.PJKBaseDataGridViewCheckBoxColumn Column3;
        private BCCI.Controls.PJKBaseButton pjkBaseButton1;

private void InitializeComponent()
        {
            this.pjkBaseDataGridView1 = new BCCI.Controls.PJKBaseDataGridView();
            this.Column1 = new BCCI.Controls.PJKBaseDataGridViewTextBoxColumn();
            this.Column2 = new BCCI.Controls.PJKBaseDataGridViewTextBoxColumn();
            this.Column3 = new BCCI.Controls.PJKBaseDataGridViewCheckBoxColumn();
            this.pjkBaseButton1 = new BCCI.Controls.PJKBaseButton();
            ((System.ComponentModel.ISupportInitialize)(this.pjkBaseDataGridView1)).BeginInit();
            this.SuspendLayout();
            // 
            // pjkBaseDataGridView1
            // 
            this.pjkBaseDataGridView1.AllowUserToAddRows = false;
            this.pjkBaseDataGridView1.AllowUserToDeleteRows = false;
            this.pjkBaseDataGridView1.ColumnHeadersHeightSizeMode =   
System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.pjkBaseDataGridView1.Columns.AddRange(
                new BCCI.Controls.PJKBaseDataGridViewColumn[] {
            this.Column1,
            this.Column2,
            this.Column3});
            this.pjkBaseDataGridView1.Location = new System.Drawing.Point(12, 24);
            this.pjkBaseDataGridView1.Name = "pjkBaseDataGridView1";
            this.pjkBaseDataGridView1.ReadOnly = true;
            this.pjkBaseDataGridView1.Size = new System.Drawing.Size(344, 150);
            this.pjkBaseDataGridView1.TabIndex = 0;
            // 
            // Column1
            // 
            this.Column1.HeaderText = "Column1";
            this.Column1.Name = "Column1";
            this.Column1.ReadOnly = true;
            // 
            // Column2
            // 
            this.Column2.HeaderText = "Column2";
            this.Column2.Name = "Column2";
            this.Column2.ReadOnly = true;
            // 
            // Column3
            // 
            this.Column3.HeaderText = "Column3";
            this.Column3.Name = "Column3";
            this.Column3.ReadOnly = true;
            // 
            // pjkBaseButton1
            // 
            this.pjkBaseButton1.Location = new System.Drawing.Point(212, 193);
            this.pjkBaseButton1.Name = "pjkBaseButton1";
            this.pjkBaseButton1.Size = new System.Drawing.Size(75, 23);
            this.pjkBaseButton1.TabIndex = 1;
            this.pjkBaseButton1.Text = "pjkBaseButton1";
            this.pjkBaseButton1.UseVisualStyleBackColor = true;
            this.pjkBaseButton1.Click += new System.EventHandler(this.pjkBaseButton1_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(702, 273);
            this.Controls.Add(this.pjkBaseButton1);
            this.Controls.Add(this.pjkBaseDataGridView1);
            this.Name = "Form1";
            this.Text = "Form1";
            ((System.ComponentModel.ISupportInitialize)(this.pjkBaseDataGridView1)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

       
    }
}
It bombs on the AddRange bit, if I change it to System.Windows.Forms.DataGridViewColumn[] ( of which my class is a subclass ) it works _ I don't get it !!!, surely System.Windows.Forms.DataGridViewColumn and PJKBaseDataGridViewColumn are the same thing ?
public class PJKBaseDataGridViewColumn : System.Windows.Forms.DataGridViewColumn
    {
        public PJKBaseDataGridViewColumn()
        {
        }
    }
Regards,
Peter J. Kane



Pete
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform