Archived

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

k_hole9

VB programming and passing objects

Recommended Posts

k_hole9    122
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 this post


Link to post
Share on other sites
krez    443
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 CObjectClass
Dim Obj2 As New CObjectHandlingClass
Obj2.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 this post


Link to post
Share on other sites
k_hole9    122
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.


Please help

Thanks

Share this post


Link to post
Share on other sites