I've created user control which hosts datagridview and other controls. Then I drop it onto a form. How do I allow myself to customize grid's properties (like which columns are 开发者_如何学JAVAshown) in a target form?
I thought setting its modifier to public will suffice.That should do it, then you can address the grid through your user control instance. Assuming you control is named "MyControl" and your grid within the control is named "MyGrid" then you should be able to use MyControl.MyGrid.
to get to the properties.
You can add properties to your UserControl that helps you to change design of your Control from different forms.
Problem not solved in that general way I initially posed it.
As a quick hack I declared public properties for some of the grid properties I needed (like Columns collection)
Tnanx for your help, though.
精彩评论