Re: Pass object to another form?
From: Thorsten Dörfler (t.doerfler_nospam_at_bdsw.de)
Date: 05/27/04
- Next message: Unforgiven: "Re: Precision problems"
- Previous message: SS: "Opening a web page through VB"
- In reply to: Grahammer: "Pass object to another form?"
- Next in thread: Carl Manaster: "Re: Pass object to another form?"
- Messages sorted by: [ date ] [ thread ]
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/
- Next message: Unforgiven: "Re: Precision problems"
- Previous message: SS: "Opening a web page through VB"
- In reply to: Grahammer: "Pass object to another form?"
- Next in thread: Carl Manaster: "Re: Pass object to another form?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|