|
-
Dec 12th, 2006, 11:07 AM
#1
Thread Starter
Fanatic Member
Anything wrong with this approach to programming? - Part II
I posted earlier on a similar topic (see thread "Anything wrong with this approach to programming?") , and received some really great responses. Now, I have a few more questions that are a lot more specific.
For those that didn't read my last thread, I was asking about adding a new form to my existing project. The new form behaves almost exactly the same as the old form, so I'm trying to enhance my code as much as possible. Anyway, here are my questions...
1) Since both of my forms are the same, is it okay to name all of the controls on each form the same thing? I'd like to do that because there are times where I refer to my form within a function or class. For example, sometimes I run a query in a code module, and then loop through the query populating values on a form within that same function. If I name all of the controls on both forms the same thing, then that makes my classes much simpler.
2) We all know duplicate code isn't great. But what if both of my forms have a click button with two or three lines of code in it that are all the same. Is it worth creating a function or class to eliminate the duplicate code in this case? That kind of takes us back to the whole control thing again, naming them all the same.
Any tips are appreciated.
- The_Grudge
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|