jwcolby
jwcolby at colbyconsulting.com
Mon Jul 12 20:39:20 CDT 2004
>The line lngWibble = ReadSomeFileAndFetchWibbleValue() is late binding. The variable isn't bound to the specific value until the code is run. Not exactly true. If Function ReadSomeFileAndFetchWibbleValue() as String (for example) then the returned value is a string and the compiler can check that the function is returning the same data type as lngWibble. Early binding (kind of). If: Function ReadSomeFileAndFetchWibbleValue() Then the returned value is a variant (in VB anyway) and the process will still work correctly due to coercion however it is "late bound" (kind of). In fact early and late binding don't really apply to built in data types such as strings and numbers (in VB at any rate) since these are not objects. Objects are typically classes or OCXs etc which have methods and properties. In .Net however, even variables such as integers and strings are objects with methods and properties so all of a sudden early and late binding might just apply to them... John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob Hall Sent: Monday, July 12, 2004 5:54 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] more on early versus late binding On Mon, Jul 12, 2004 at 02:55:50PM -0400, Susan Harkins wrote: > > > > My question is -- does checking a reference or modifying a reference > > using the Reference object and its many properties and methods fall > > into either category? > > No. > > From a Knowledge Base article on Access: > > "Dim objAccess As Access.Application" > This type of declaration is called early binding, which is > fastest. > > The article's example of late binding is > > Dim objAccess As Object > > "Binding" refers to binding a variable to an object. Setting a > reference tells your code where a predefined class can be found. Of > course, you've got to set a reference to do early binding, so the two > tend to get mixed together. > > ===========Interesting take -- the terminology's the thing... :) So, > the References collection and Reference objects are just explicit > referencing -- nothing to do with binding other than it enables early > binding -- OK. Right. Early and late binding are generic coding concepts; they have nothing to do with Microsoft or the Reference collection. The line lngWibble = 47 is an example of early binding; the variable is bound to the specific value when the code is written. Note that the Reference collection isn't involved. The line lngWibble = ReadSomeFileAndFetchWibbleValue() is late binding. The variable isn't bound to the specific value until the code is run. Generally, late binding gives you more flexibility and early binding gives you more speed. -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com