#### Archived

This topic is now archived and is closed to further replies.

# VB programming and passing objects

## Recommended Posts

In VB is it able to pass a object to other objects? Do I have to reference it, such as a header file? //////////////--------------------------------- Option Explicit Dim ConnectionObject As adoConnection Public Sub Start_Program() Set ConnectionObject = New adoConnection ConnectionObject.Create_Connection Call Control_Main End Sub Public Sub Control_Main() End Sub Public Sub Open_Form(FormType As Integer) HttpForm.Show HttpForm.Add_List (ConnectionObject) End Sub //////////////--------------------------------- Option Explicit Public Sub Add_List(adobject As adoConnection) MsgBox "hello" End Sub the error is: "object does not support this property or method please help Thanks. Edited by - k_hole9 on December 17, 2001 12:05:26 AM

##### Share on other sites
quote:
Original post by k_hole9
In VB is it able to pass a object to other objects? Do I have to reference it, such as a header file?

you just pass it like any other variable:
Dim Obj1 As New CObjectClassDim Obj2 As New CObjectHandlingClassObj2.SomeFunction(Obj1)

you just have to make sure that you pass an object of the proper type for the functions arguments. no header files or anything like that in VB.
quote:
the error is: "object does not support this property or method

this error pops up when you try to use a property or method of something when it doesn''t have that property or method. i never played with the types in your code, so i can''t say what exactly was causing it.

--- krez (krezisback@aol.com)

##### Share on other sites
Thanks for that,

I tried it with passings an integer, and it did work.

Can i pass objects to a form object''s user-defined function? Maybe this is causing the problem.

Thanks

##### Share on other sites
I placed the brackets around the function call, which stuffed it up
thanks again

• ### Forum Statistics

• Total Topics
628301
• Total Posts
2981906

• 9
• 11
• 11
• 10
• 10