Click here to Skip to main content
13,398,199 members (32,004 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi Everyone,
I created new component that is inherited by dataGridView. I can add a new browsable property to mydataGridView. Also I want to add property for column of mydataGridView. It should be browsable. Because i want to see on properties windows. It's type is not important, may be int or string. Then i should use in code like "mydataGridView1.Columns[0].MyProperty = 100;".

How can i do this?

Ibrahim Uylas
Posted 8-Jan-13 21:59pm
jibesh 9-Jan-13 3:17am
But what type of DataGridColumn you are going to use? this property should be available for all the DataGridColumn types ie TextBox,Combo,CheckBox etc
İbrahim Uylaş 9-Jan-13 3:30am
All of them. This property should be like Column Text. I don't want to use Tag property. If i don't find any solution i will use it.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can create new classes derived from different DataGridViewColumn types and define the new property in your derived class.
public class DataGridTextBoxColumnEx : DataGridViewTextBoxColumn
  public int Bump

and use it like this in your UI designer class.
private void InitializeComponent()
  //replace the following code all the references to your derived class
  this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  this.Column2 = new DataGridTextBoxColumnEx();  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180216.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100