Click here to Skip to main content
15,888,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I developed a reporting module with a startup form in a separate project in vb.net. I have since created a new vb.net win form project with a midi parent. I would like to call the existing report program and have it open as a child to the neparent.

In VB6 I had routines that would let me set the parent attribute in a form in a separate project.

Is there something similar in vb.net?

What I have tried:

In the VB6 code I have;
Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long


routines
Public Function fun_ParentHwnd(Optional nHwnd As Long, Optional bClear As Boolean) As Long


    Dim n   As Long
    
    'Read registry setting for ParentHwnd from Parent form

    n = GetCUSetting("", "ParentHwnd", 0)

    fun_ParentHwnd = n
        
End Function
Sub MakeMeChild(nHwnd As Long)

    Dim nRet    As Long
    
    UBhWnd = fun_ParentHwnd
    
    nRet = SetParent(nHwnd, UBhWnd)
    
    UBhWnd = ubHandle

End Sub
Posted
Updated 5-Mar-19 17:45pm

1 solution

You can add a "reference" in your current project to the "other" project; just reference the .exe or the .dll (if it's a class library).

(Yes; an .exe can be accessed as you would a .dll as long as the accessed form / window / class is public).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900