|
-
Jun 5th, 2004, 02:03 AM
#1
Thread Starter
Lively Member
Programming Style
can someone list some programming styles that will help make the program run faster or make it run better? like does having alot of command buttons make the program lag?
-
Jun 5th, 2004, 02:17 AM
#2
Fanatic Member
Well I follow these rules
1) Nullify objects when they are nolonger needed
2) Donot use sequential search when the records are more than 50
3) Donot overload one form. instead use two sequential forms or tabbed controls
4)Donot validate toomay things in one click
5) Use DoEvents whenever something is to take time this minimizes user frustration atleast
6) When something is going to take time always enable a "Cancel" button
7) Donot load all the files(if big) contents at one go into the memory if it is to be loaded, load it in chunks
8)Open a Database connection open at form Load and avoid subsequent time lapses
10)Avoid big string comparisons in loops
11)If there are big loops the try to use binary search or index the contents of the searched items and get to point
12)Mostly Time lapse is caused by Databases, Disk read/writes,Loops so concentrate on these.
13) No of objects in a form comes into picture only if not enough M-square(Main Memory) is there.
HTH...
-
Jun 5th, 2004, 02:27 AM
#3
Addicted Member
One thing I would add to that list. DO NOT set timer's to intervals like 1. I have seen too many beginner's do that. Set it to the maximum time possible. Otherwise the CPU usage will spike like nothing, even if the timer isn't doing anything.
-
Jun 5th, 2004, 02:29 AM
#4
Addicted Member
By the way, if you want help from us with your code, we have the right to ask why you want to do something. If you don't like that, you can look elsewhere (see my sig) or continue to try to figure it out yourself.
And, also, before you ask how to enumerate the windows, search. You are going to be told to do that anyway. PSC is a great place to start. I am sure these forums have threads on it as well.
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
|