Is there a way to auto generate controls on a form

2020-01-29 02:41发布

When I add a binding source to my windows form, is there a quick way to populate the form with all the properties of the bound object?

A drag and drop Field List, similar to that found in many report writers would be good.

1条回答
Root(大扎)
2楼-- · 2020-01-29 03:34

In Visual Studio, the Data Sources Window displays the data sources in your project. You can use Data Source Configuration Wizard to create and edit data sources from databases, services, or objects. After creating data sources in your project, you can use the Data Sources window to create data-bound controls in your user interface by dragging items from the window onto a design surface in your project:

  • Show Data Source Window from menu View > Other Windows > Data Sources or by using its shortcut Shift+Alt+D.

  • Add new Data Source using Add new Data Source toolbar button in Data Source Window or using menu Project > Add New Data Source.

  • Open a form and then in Data Source Window Set the Control to be created when dragging from the Data Sources Window. If you choose details mode in Data Source Window, for each field of data source a control will be placed on the form. If you choose DataGridView mode, DataGridView will be placed on the form.

enter image description here enter image description here

查看更多
登录 后发表回答