Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WithEvents ...
Message
 
To
21/06/2001 09:28:53
General information
Forum:
Visual Basic
Category:
COM, DCOM and OLE automation
Title:
Miscellaneous
Thread ID:
00521653
Message ID:
00522253
Views:
13
Ben -- I am not sure if this will help/make a difference, but I want to point out that there is a slight, but important, difference between late/early binding and the use of CreateObject/New.

Early binding means that a project reference has been added to VB, and the variable has been DIM'd as a type of that object. But whether you use NEW or Createobject(), in this context, doesn't affect your ability to use WithEvents.

When you say that you "might have to go to latebinding and use CreateObject instead" what do you mean? Are you also removing the references, and DIM'ing your variables as objects (or variants)? If so, I can't think of anything to solve your problem.

But, some folks I know prefer CreateObject() to NEW even when using Project References (I hear tell of a memory leak using NEW, though I haven't come across this myself). If this is your situation, you are in luck: WithEvents will work just fine.

In other words, early binding allows you to use either NEW or CreateObject. Late binding requires CreateObject. But, just because you are using CreateObject, it doesn't mean that you have stopped using early binding. It's the project references and the DIM'ing that count.





>>
>>With vb6...
>>
>>We are 'earlybinding' the classes that we are using. And some of them are instantiated with WithEvents keyword. I might have to go to latebinding and use CreateObject instead.
>>
>>I'm just hopefull but ... Is there something that will reproduce the WithEvents features when instantiating it with CreateObject?
>>
>>I'm not sure ... but I think I read somewhere that I can name a procedure of the form with the name of the object followed by the event (Private sub myObject_EventXXX) ... or something like that ! What is just my imagination ?
>
>Events cannot be intercepted when using late binding.
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform