views:

575

answers:

1

Hi,

I'm trying to develop a small utility (a WinForms app) and I was hoping (to save time) to use a WinForms equivalent of an ASP.net FormView or DetailsView (to bind to) - i.e. for single objects (as opposed to multiple objects, which we could use a DataGridView for).

It's been about three years since I did anything meaningful in the world of WinForms (and I'm not in a position to do this in WPF) - can anyone suggest a control or container which supports databinding and works in a similar way to the ASP.net's FormView implementation?

The basic idea is to bind to either Plain Old CLR Objects (POCO) or DTO (Data Transfer Objects). However, I'm starting to feel like this is an exercise in diminished returns.. or perhaps I need a third party control..Infragistics?

/R

+2  A: 

The WinForms uses somewhat another paradigm. It uses BindingSource and this not matter what control you use. For example it could be simple UserControl or even Panel.

Following are steps to bind your class to form.

  1. Drop BindingSource on you form or panel or whatever...
  2. In DataSource poperty click Add Project Data Source.

  3. Select Object, select object you want to bind.

  4. Click Finish. At this stage we have datasource configured. Next steps will generate something similar to FormView.

  5. Open Data Sources docked window.

  6. With drop-down select Details.

  7. Drag and drop that to your form.

Result should be the form similar to the FormView.

Let me know if you have any questions.

Mike Chaliy
You may want to check the list of fields first and change some to Label or Combobox as appropriate.
Henk Holterman