Re: dimension help please
Quote:
Originally posted by jeffc
a. Dim objInventory As Inventory
Set objInventory = CreateObject(Inventory)
b. Dim objInventory As Inventory
Set objInventory = New Inventory
c. Dim objInventory As Object
Set objInventory = New Inventory
d. Dim objInventory As New Inventory
Let's analyze.
A. Using a function is faster, but when used in conjuction with the Set keyword, it slows the process down quite a bit. This is not true, however, if the program is run over a network. But only if the program is on the server, not the clients. Because the client system must get permission for everthing.
C. You should always be as specific as possible when dimensioning a variable. When dimensioning a variable as an Object, VB must load and allocate several different dynamic link libraries and active-x directories in order to set the object to the one you specify later. However the usual rules of option A. apply here, too.
D. Don't do this. This method forces your application to refresh every variable in the program. Use of the New keyword is not recommended by MSDN. The process is very time comsuming. The OS is forced to allocate pointers for all variables, dump the used RAM, and reallocate space in the RAM for the variables.
for more information, check geoff_xrx's idea, or Wayne's idea
:)