How to pass objects between modules

How to pass objects between modules

Post by C. Jonathan Su » Thu, 23 Oct 1997 04:00:00



I am using VB5.  I am trying to pass objects such as Data1 and frmForm1 from
a form module (Form1.FRM) to procedures in the standard module (Module1.BAS)
.  The Data1 is type of Data, and the frmForm1 is type of Form.  The
following is the sample code.  I view the values in the Watch window.  All
the buttons enabled status changed as specified when the Sub
changeButtonStat is executed, but the buttons on the frmForm1 did not get
changed when the execution resumes at the form module.  Does anyone know
why?  Is this the correct way to pass objects in VB5?  Thanks for your help.
I would appreciate if you would copy your reply to my email address.

'from Form1.FRM
private sub txtFields_Change(Index As Integer)
    call changeButtonStat(frmForm1)
end sub

'from Module1.BAS
public sub changeButtonStat(ByRef FormName as Form)
    with FormName
        .cmdAddBtn.enabled = false
        .cmdEditBtn.enabled = false
        .cmdDeleteBtn.enabled = false
    end with
end sub

--
Jonathan

 
 
 

How to pass objects between modules

Post by Ron Dawso » Thu, 23 Oct 1997 04:00:00



> I am using VB5.  I am trying to pass objects such as Data1 and frmForm1 from
> a form module (Form1.FRM) to procedures in the standard module (Module1.BAS)
> .  The Data1 is type of Data, and the frmForm1 is type of Form.  The
> following is the sample code.  I view the values in the Watch window.  All
> the buttons enabled status changed as specified when the Sub
> changeButtonStat is executed, but the buttons on the frmForm1 did not get
> changed when the execution resumes at the form module.  Does anyone know
> why?  Is this the correct way to pass objects in VB5?  Thanks for your help.
> I would appreciate if you would copy your reply to my email address.

> 'from Form1.FRM
> private sub txtFields_Change(Index As Integer)
>     call changeButtonStat(frmForm1)
> end sub

> 'from Module1.BAS
> public sub changeButtonStat(ByRef FormName as Form)
>     with FormName
>         .cmdAddBtn.enabled = false
>         .cmdEditBtn.enabled = false
>         .cmdDeleteBtn.enabled = false
>     end with
> end sub

> --
> Jonathan


Assuming the Name property of Form1.FRM is frmForm1, change your call
to:

        call changeButtonStat(Me)

 
 
 

1. Passing a COM Object to another COM Object?

Is it possible to pass a COM object to another COM object if the second COM
object is not set up to receive an object address/handle?  Specifically, I
would like to post a DOMDocument to a URL using a ServerXMLHTTP object via
MSXML.  Following is a code snippet demonstrating what I would LIKE to do,
yet have been unable to figure out.











The functionality I am trying to imitate (in Visual Basic) is:

Dim d As New MSXML2.FreeThreadedDOMDocument40
Dim o As New MSXML2.ServerXMLHTTP40
Call d.loadXML("<root test=""value""/>")
Call o.open("post", THE_URL, False)
Call o.send(d)

Is something like this possible using SQL?

Thanks!

Kirk Barden

2. After install cannot connect to SQL SErver Error

3. How to pass one xmldom object to a node of another xmldom object

4. >>> Motif Mailing List <<<

5. Passing a connection object from ASP to a COM object

6. Conspiracy Theory’s real Script: Slave CIA, FBI change the story jews wanted to tell the media

7. Passing SET statements between modules...

8. WANTED: CD-ROM of (Business) Addresses

9. Pass variable value back to form from module

10. How to pass variable from class module in seperate project

11. passing forms and controls so I can set focus back to a form from a module

12. Can you pass form to a module (*.bas)??

13. Passing Array to Class Module Function