Results 1 to 11 of 11

Thread: VB6.0 slow

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Red face VB6.0 slow

    Hi All!!
    I am using vb6.0 from 5 years.
    Starting projects were small enough.
    Now My projects are so much large about 150 forms in one project.
    There are 2 problems,
    1.When i open my project and goto definition of any of procedure/function, it takes too much time at start.
    2. And secondly if i make one line change also, it takes so much time for making exe of my application,.

    Is it possible to reduce this time ?
    Thanks.
    WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST

  2. #2
    Frenzied Member
    Join Date
    Mar 2009
    Posts
    1,182

    Re: VB6.0 slow

    Well for opening vb faster, close all the forms and code windows you can and only leave one or none of the windows open. This will allow vb to load your project faster because it does not have to read in the specific files of your project so it can display them. As for making the compile time of your exe shorter then I would suggest that you start moving some of the functionality to controls/dlls/activex exe's.

    Good Luck
    Option Explicit should not be an Option!

  3. #3
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    279

    Re: VB6.0 slow

    If I have learned one thing in my 12 years of programming, it's that the only limitations are problems that I can't think of another solution for.

    You could try writing your own dlls, make sure to use object arrays as much as possible, and generate some of the objects from code. This would also help you compartmentalize your project better.

    Also, 150 forms is quite ridiculous. No offense, but there has to be some degree of redundancy in what you are doing. Sounds like the whole project could use a massive overhaul.

    Good luck!

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Re: VB6.0 slow

    vb5prgrmr & deathfxu,
    thanks for you reply.
    I will try to make dlls if possible.

    Also, 150 forms is quite ridiculous. No offense, but there has to be some degree of redundancy in what you are doing. Sounds like the whole project could use a massive overhaul.
    I am surely not having redunduncy for my project.
    As i am developing erp like software, each form is different in design and functionality.
    WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST

  5. #5
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    279

    Re: VB6.0 slow

    Yeah, the dll option is definitely the best here.

    I had a project a while back that I used one form (which I could create multiple instances of) that morphed the items on it based on why that specific instance of the form was being loaded. Would maybe something like that be usable for you?

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Re: VB6.0 slow

    yes. i think it will be useful for me.
    Can you give me more details of it ?
    Thanks for reply.
    WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST

  7. #7
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    279

    Re: VB6.0 slow

    Make a form in a new project and put 2 buttons on it. cmdNew (caption "New") and cmdClose (caption "Close"). Then paste this in code window:

    vb Code:
    1. Private Sub cmdClose_Click()
    2.  
    3. Dim isaForm As Form
    4.  
    5. For Each isaForm In Forms
    6.     Unload isaForm
    7. Next
    8.  
    9. End Sub
    10.  
    11. Private Sub cmdNew_Click()
    12. Dim imaNew As Form
    13.  
    14. Set imaNew = New Form1
    15. Load imaNew
    16. imaNew.Show
    17.  
    18. End Sub

    This shows the basic interaction of creating/handling forms via code. I'll post more in a minute.

  8. #8
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    279

    Re: VB6.0 slow

    Objects on a form are easier to make new copies of if you use the Index property. For instance:

    vb Code:
    1. Dim newTBox As Integer
    2.  
    3. newTBox = UBound(Text1()) + 1
    4. Load Text1(newTBox)
    5. Text1(newTBox).Text = CStr(newTBox)

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2006
    Location
    nasik,india
    Posts
    909

    Re: VB6.0 slow

    Thanks deathfxu .
    Definitely i will try this code..
    But what about my existing projects/forms, can i reduce time for making exe ?
    WHETHER YOU SUCCEED OR FAIL IS NOT AS IMPORTANT AS WHETHER YOU TRIED YOUR BEST

  10. #10
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    279

    Re: VB6.0 slow

    Then you can have a global collection which keeps track of what each new form is supposed to be. Like this:

    vb Code:
    1. 'in a module
    2. Global FormPurpose As New Collection
    3.  
    4. 'in the form code
    5. Dim FormNum As Integer
    6. Dim MyPurpose As Integer
    7.  
    8. Private Sub Form_Load()
    9. FormNum = Forms.Count
    10. MyPurpose = FormPurpose.Item(FormNum)
    11.  
    12. Select Case MyPurpose
    13.    Case 1 'first layout
    14.       'generate form objects via code
    15.       'set their default values
    16.       'place them in desired locations on form
    17.    Case 2 'second layout
    18.       'etc
    19. End Select
    20.  
    21. End Sub
    22.  
    23. Private Sub cmdNew_Click()
    24. Dim imaNew As Form
    25.  
    26. FormPurpose.Add "7"
    27. Set imaNew = New Form1
    28. Load imaNew
    29. imaNew.Show
    30.  
    31. End Sub

    This is just a basic concept so you can get an idea of how it can be done.

    Good luck!

  11. #11
    Hyperactive Member deathfxu's Avatar
    Join Date
    Mar 2009
    Location
    USA
    Posts
    279

    Re: VB6.0 slow

    With more dlls and less objects created by ui (because they are being created with code), the time for making an exe should be drastically faster.

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