Results 1 to 4 of 4

Thread: Programming Style

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Posts
    87

    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?

  2. #2
    Fanatic Member sridharavijay's Avatar
    Join Date
    Sep 2002
    Location
    http://www.vijaysridhara.in
    Posts
    589
    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...

  3. #3
    Addicted Member
    Join Date
    May 2004
    Location
    China
    Posts
    228
    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.
    You know the best way to find the answer to your question? SEARCH!
    www.google.com
    www.planet-source-code.com
    www.msdn.com
    http://www.vbforums.com/search.php?s=
    P.S. Its faster than waiting for replies too!

    [vbcode]
    If InStr(1, Message, "FIX MY CODE") <> 0 Then Reply = False
    If AnswerIn(Google, VB_Forums, PSC, MSDN) = True Then Reply = False
    [/vbcode]

  4. #4
    Addicted Member
    Join Date
    May 2004
    Location
    China
    Posts
    228
    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.
    You know the best way to find the answer to your question? SEARCH!
    www.google.com
    www.planet-source-code.com
    www.msdn.com
    http://www.vbforums.com/search.php?s=
    P.S. Its faster than waiting for replies too!

    [vbcode]
    If InStr(1, Message, "FIX MY CODE") <> 0 Then Reply = False
    If AnswerIn(Google, VB_Forums, PSC, MSDN) = True Then Reply = False
    [/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width