Re: Pass object to another form?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Thorsten Dörfler (t.doerfler_nospam_at_bdsw.de)
Date: 05/27/04


Date: Thu, 27 May 2004 14:22:40 +0200


"Grahammer" <dont.spam@me.here> schrieb:

> I'm trying to pass an object (or just the values that it contains) to a
> function on another form. When I do this I get an "Object doesn't support
> this property or method" error during runtime. Passing by value or by
> reference makes no difference.

Objects in VB are always passed by reference.

> What I am trying to do is pass an object to a settings form, change some
> settings and either have the object reflect the new changes, or return a new
> object that I can apply agains the original object.
>
> Sample code is below and contains ALL the code in my test app. My real app
> has much more complicated objects.
>
> Form contains a single CommandButton named Command1.
>
> '*** FORM1 ***
> Dim test As Class1
>
> Private Sub Command1_Click()
> Load Form2
> Form2.DoStuff (test) '<<< ERROR HERE

Assuming you are using VB-classic, there is no need for parenthesis.
Set a "Call" before it or remove the parenthesis and it works.

Otherwise the arguments are passed by value, what doesn't work with
objects.

Thorsten Dörfler

-- 
http://www.vb-hellfire.de/


Relevant Pages

  • RE: base64 convertion
    ... The sample code is provided as a Class Library, you can reference the ... Extract the sample project to a local folder ... Microsoft Online Community Support ...
    (microsoft.public.vsnet.general)
  • RE: WSS QuickLaunch Headings
    ... the associated URL to the headings cannot be removed by WSS 3.0 OOB features. ... \par The sample code retrieves all the hyperlinks in the page, and removes the specific URL association matched with your condition. ... \par Please notice, the sample code is only for your reference, you need to change it based on your real requirement. ... \par var anchors = document.getElementsByTagName; ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Huge problem and no idea...
    ... if you want a parenthesis around an equation number you should use ... the command \eqref from amsmath. ... The problem here is that the reference number is 2.1 and is inserted ...
    (comp.text.tex)
  • Re: How to exchange certificate ?
    ... "Richard Grossman" wrote in message ... >> The sample code which I referenced in an article does exactly the above ... > reference to certificate. ... > problem is to get the key from a certificate and not to generate a key. ...
    (microsoft.public.platformsdk.security)
  • Re: Insert image into text box
    ... I tried to reply on the last thread, but the sample code I sent was too ... You will probably need to retrieve the window from behind Word to ... The picture loaded is c:\test.jpg - so you have to put a small picture ... have a picture elsewhere change the source code to reference it. ...
    (microsoft.public.office.developer.automation)