Structuring a VB5 app: user controls or setparent?

Posted on 1998-08-06
Last Modified: 2010-04-30

I'm an intermediate VB programmer building an app that will useapex  truegrids. I need an insight or two as to the best way to build a commercial compiled single user VB5 app which uses 5 truegrids. The 5 grids will be displayed on 4 tabs (farpoint's tab pro 2.0). They display different collections of records housed in one access database and accessed via DAO 3.5. they will show cities and hotels. Users will need to see three of the grids (on tabs 1 & 2) very often, and grids 4 &  5 once in a while.

One of my major concerns is to keep the app as responsive and fast as possible. Rather than just have all controls (including the grids) on each tab (ending up with one very large form) always loaded, I want to load into memory only those portions of the app the user needs, when they need them, then unload them.

Which of these approaches would you recommend?

1. Create the grid as a single activex usercontrol and set its appearance and data each time its instanced,
2. Put each grid into its own form and its own vb.dll and Setparent it to my main form as it is accessed,
3. do a control array of the grids,

I'd very much appreciate some guidance here.
Question by:cellphone
  • 3
  • 2

Accepted Solution

BlackAndWhite earned 200 total points
ID: 1468129
'Setparent' the grid is going to cause lot of headaches as I have known especially when are doing it from a different form.  The positioning has to be taken care of and it is messy at times.

If I were you I would use a control array and refresh the grids as and when needed ie. when the user tabs into that tab if it is too memory consuming.  

If it is going to display 5 records each in each tab, I would rather have separate grids on each tab and not worry about the form being in memory.


Author Comment

ID: 1468130
what about putting the grid into a usercontrol and instancing it as the user enters a given tab? If I use 5 instances of the usercontrol do I end up with the grid in memory 5 times or once? Thanks

Expert Comment

ID: 1468131
Are you saying that you want to put layer on top of the grid and provide a property and method interface to the underlying grid.  Thats tough and it wouldn't serve the purpose.  It would only increase the amount of memory needed.

Author Comment

ID: 1468132
what about putting the grid into a usercontrol and instancing it as the user enters a given tab? If I use 5 instances of the usercontrol do I end up with the grid in memory 5 times or once? Thanks

Expert Comment

ID: 1468133
You mean you are going to create a usercontrol with the grid as a component inside it... Did you know that you had to write all the code to give the user access to all the properties and methods that the grid itself supported.  Some of it may noteven be accessible to you if you try to do it because of design and run time regulations that the grid has imposed.  

To your question, 'Yes it is more memory consuming and very very tedious'.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
I need help formating a date variable in my VB.Net application 2 60
Visual Studio 2005 text editor 10 44
Excel Automation VBA 19 88
Set WorkSheet  not Working 9 39
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question