C# - What is a component and how is it typically used?

后端 未结 3 1416
遇见更好的自我
遇见更好的自我 2020-12-14 06:44

What is a component class and where would I typically use one?

When I add a new item to my project in VS.NET 2008 one of the options is to add a component. I am not

3条回答
  •  执笔经年
    2020-12-14 07:15

    If you mean a class that inherits from System.ComponentModel.Component, like for example the System.Windows.Forms.BindingSource and strongly-typed DataSets, this will allow to drag an instance on the Visual Studio design surface (on a form in design-time) and set some properties using the property grid.

    Once there is an instance of such component on the form it is discoverable by other components/controls. For example a BindingSource can be selected as a data source for a grid view or some other control.

提交回复
热议问题