3

In ASP.NET you have something called "User Controls", which allow you to design a custom control which can be reused in the website.

I am now starting developing a Windows application in .NET 2.0 and (surprisingly) I cannot find a similar functionality.

What I would like to do is: - Create a new user control in the designer; - Drag & Drop a few controls on it (e.g. buttons, textboxes); - Save, and be able to resuse this user controls by dragging and dropping it on various dialogs.

Any suggestion would be greatly appreciated.

Thank you, Giammarco Schisani

Ksempac
  • 1,842
  • 2
  • 18
  • 23

1 Answers1

5

UserControl

Step-by-step guide to create, add and use UserControls in WinForms applications: http://www.devcity.net/Articles/87/ssteps_customcontrol.aspx

Main steps are:

  • Create a library project
  • Add or customize the default UserControl
  • Build the project
  • Add a new windows application project
  • Open the Form in the designer: your new control appears.
boj
  • 10,935
  • 5
  • 38
  • 57
  • +1 : Just the right link, was always well awarded in expertsExchange, I remember. At SOF this beheviour still have to kick in a bit more – Peter Apr 16 '09 at 12:27
  • Ehem...refresh before comment pls – boj Apr 16 '09 at 12:29
  • 1
    @Peter: There are philosophic reasons behind this behavior. This place is going to be Wikipedia in programming field. It's more community-oriented than *solve the guy's problem and go*. – Mehrdad Afshari Apr 16 '09 at 12:35
  • @boj, thank you, but this is not exactly what I was looking for. I wonder if there is a way to achieve this using the designer, as we do in ASP.NET. – Giammarco Schisani Apr 16 '09 at 13:08
  • May I misunderstood something but which steps are missing in WinForms? - Create a new user control in the designer (works, in the same project too) - Drag & Drop a few controls on it (works) - Save, and be able to resuse this user controls by dragging and dropping it on various dialogs (works) – boj Apr 16 '09 at 14:56