Re: Newbie: access function of Form1 from Form2

Tech-Archive recommends: Fix windows errors by optimizing your registry



"steve" <steve@xxxxxxxx> schrieb

Whenever you want to access an object, you need a reference. If you
don't  have it you must make it accessible. This is usually done by
passing it as  a property value or as a procedure argument.

Yes, but as i said, Form 1 is "alive" in the background. The object
exists. Wouldnt it be an overkill to instantiate a new (non-visible)
form1 as New  myProject.Form1 ?

Since it exists I just want to access its methods from form2.

If i had killed it and instantiated a Form2, I would understand.

I did not write that you should create a new instance. You must pass a reference to the existing instance.


Armin

.



Relevant Pages

  • Re: Passing by reference
    ... It depends upon the reason one is passing the reference. ... instantiate all relationships via a constructor so there will always be ... I naturally think of 'getter' methods as 'knowledge ...
    (comp.object)
  • Re: Access Application object from class
    ... I never instantiate it.... ... >From the sound of things, it looks like I'd be wise just passing things in ... You should realize from here that saving references to intrinsic ... I'd stick with passing ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: calling from one workbook the classes and functions in another
    ... having discovered the vb trick recently I'm suddenly a big fan ... > reference to the instantiated class. ... you can't instantiate the class. ... >> Copy your cls into a VB Project for an activex dll. ...
    (microsoft.public.excel.programming)
  • Re: Design question: Multiplying singletons
    ... Since relationship implementation is orthogonal to class semantics and it is usually easy to implement when originally defining objects, it is usually a good ideal to implement the *-side of such relationships and instantiate them properly even if there is no immediate need to navigate them. ... but not as much to keep the reference to the whole in the ... through the AController object. ... One could use a factory like AController to instantiate the relationships dynamically, ...
    (comp.object)
  • Re: VB6 Common Code for Access, Excel and VB Projects
    ... Instantiate the class as, say, YourClass, then qualify each reference to ... > without a class module included as well. ... >> Compile the code to an ActiveX DLL and add a reference to each VBA/VB ...
    (comp.programming)