Skip to main content
gamedev.net
🔒 Locked

VB programming and passing objects

Started by k_hole9 2 replies 350+ views
Original Post
k_hole9
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? //////////////--------------------------------- 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
krez
krez
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)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
k_hole9
k_hole9
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
k_hole9
k_hole9
I placed the brackets around the function call, which stuffed it up
thanks again

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.