Windows Forms - Best Practice Question

431
1
03-22-2013 01:39 PM
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Hi,

Obviously this isn't going to be a 100% agreed upon answer, but I'm curious what others think about it.

Is it "best" or "better" practice to have a new form (literally a form complete with elements etc...) for each new instance of needing a form, or is it better to re-use an existing form by re-arranging/altering values of the elements, within the code.

Any opinions are welcome, I'm mainly just curious.

For example, a particular Add-In we have has 3 actual forms in Visual Studio, but the user has to go through 5 forms for varying steps of the process (the forms are simply re-used, labels changed, etc...).
0 Kudos
1 Reply
LeoDonahue
Occasional Contributor III
Define "better" and "best" please.

You have a process that requires 5 user input forms, but you only created three?
Does the user access each of these forms in sequence: 1, 2, 3, 4, 5?  No skipping straight to form 3?
Do the subsequent forms rely on data entered in the previous forms?

Personally, and solely my opinion, a user form should bind to an object (class) that represents the data, then you will know the lifetime of the object and whether you've created it once already.
0 Kudos