hi all,
I am developing a front end in VB6 ...I have certain forms that have almost the same controls (text boxes, buttons etc.) but the functionality of the new form will vary. For instance the behavior of a button click will vary..or it may have an extra checkbox etc.
I need expert advise on which is the recommended approach
APPROACH 1:
Create a separate form for each individual functionality. This produces cleaner and simpler code, easy to understand and debug and free from undesirable effects of the reusable forms.
APPROACH 2:
Use the same form and add functionality to it...flags may be used to decide how the form behaves...for example depending on a certain boolean flag i can decide what the button click event does.
This produces complex and messy code. On the other hand, since I've heard that VB loads all the forms at run time, this will have a smaller memory foot print (due to less number of forms) and would make the application run faster.
APPROACH 3:
Try to combine the best of the above two approaches..i.e. use a separate form for each functionality to produce cleaner code. Then in the main forms Load event, immediately unload all the forms that are not needed...loading them explicitly through code as needed.
This way the memory usage for the code will be smaller and the code will run faster...
I may be wrong in certain of my assumptions above...and thats why this post..please correct me and help me decide the best approach for my code.
Thanks.
PS If I'm not clear in my explanation please post..and I'll try to explain it better.
I am developing a front end in VB6 ...I have certain forms that have almost the same controls (text boxes, buttons etc.) but the functionality of the new form will vary. For instance the behavior of a button click will vary..or it may have an extra checkbox etc.
I need expert advise on which is the recommended approach
APPROACH 1:
Create a separate form for each individual functionality. This produces cleaner and simpler code, easy to understand and debug and free from undesirable effects of the reusable forms.
APPROACH 2:
Use the same form and add functionality to it...flags may be used to decide how the form behaves...for example depending on a certain boolean flag i can decide what the button click event does.
This produces complex and messy code. On the other hand, since I've heard that VB loads all the forms at run time, this will have a smaller memory foot print (due to less number of forms) and would make the application run faster.
APPROACH 3:
Try to combine the best of the above two approaches..i.e. use a separate form for each functionality to produce cleaner code. Then in the main forms Load event, immediately unload all the forms that are not needed...loading them explicitly through code as needed.
This way the memory usage for the code will be smaller and the code will run faster...
I may be wrong in certain of my assumptions above...and thats why this post..please correct me and help me decide the best approach for my code.
Thanks.
PS If I'm not clear in my explanation please post..and I'll try to explain it better.