Hi, I'm developing a user control that is composed by other controls. I'd like to know if it's possible to acces this inner controls at desing time when I use them in my application. I mean, if my control has a Button, Can I access that button once I've put the control in my application Form? I Know I can access by code but I want to access in the designer. For example I wanto to change the location of the button. I think it isn't possible, I'm right? Thanks.
zwan13
Posts
-
Inheritance -
user control with a datagridviewI forgot to post that I've an instance of the grid (In the code behind): this.grid1 = new Mycontrols.Controles.Grid(this.components); So that is not the problem. Thank you. -- modified at 10:52 Sunday 3rd June, 2007
-
user control with a datagridviewI'm developing a user control which is build with a datagridview, and others controls. When I use this control in my application at desing time, I'd like to access de properties of the datagridview embebed in my control to add columns. I've created a public property to expose de grid, something like this:
private System.Windows.Forms.DataGridView _grid; [Description("Description"), Category("mycategory"), EditorBrowsable] public System.Windows.Forms.DataGridView Grid { get { return _grid; } set { _grid = value; } }
My problem is that I can't access the Columns property at desing time (In the property editor. I get this error: Object reference not set to an instance of an object. Then I decide to expose a property for the datagrid columns:[Description("My Description"), Category("MyCategory"), EditorBrowsable] public DataGridViewColumnCollection MyColumns { get { return this.grid1.Columns; } }
Now I've binded the grid to a TableDataAdapter returned by a Web Sevice. My problen now is when I add a new column, the column is not show at execution time. (At desing time I can see the column added). I think that in execution time the grid executes the databinding and rewrites my added column. The same happens if I want to hide one of the columns returned by my Web Service, in execution time the column is visible. Perhaps doing it programatically I could add and hide columns , but I want to do it the easiest possible for de developers who are going to use this control. Thanks.