Help me in Calling a form from one project if it resides in another !


Hi,

I have one form(form1.frm) in one project(Project1.vbp). I want to call this form from another project(Project2.vbp) where i am currently residing. Please help me how to call it. Please send the syntax for it.How to call form (form1.frm) if the projects belong to the same group and if they belong to different groups.

ThanX in advance for your patience and Time.

Bye...
Cheers.
Kishore.

Comments

  • : I have one form(form1.frm) in one project(Project1.vbp). I want to call this form from another project(Project2.vbp) where i am currently residing. Please help me how to call it. Please send the syntax for it.How to call form (form1.frm) if the projects belong to the same group and if they belong to different groups.

    You can always add the same form file to multiple projects. The only other option is to make Project1 an ActiveX project and encapsulate the form properties and methods with a class.

  • : : I have one form(form1.frm) in one project(Project1.vbp). I want to call this form from another project(Project2.vbp) where i am currently residing. Please help me how to call it. Please send the syntax for it.How to call form (form1.frm) if the projects belong to the same group and if they belong to different groups.

    :
    : You can always add the same form file to multiple projects. The only other option is to make Project1 an ActiveX project and encapsulate the form properties and methods with a class.
    :

    Can i call it like (CALL Project1.Form1) from project2 ? ? ?
  • : Can i call it like (CALL Project1.Form1) from project2 ? ? ?

    Only if Project1 is an ActiveX project that contains a class that encapsulates a form.

    Create an ActiveX DLL project and name it FormClasses. Add a class to it named CForm1 and add a form to the project named FForm1.

    Add any of the form's properties, events, or methods that you want to use to the class.

    For example, in the CForm1 class:

    [code]
    Private WithEvents frm as Form

    Private Sub Class_Initialize()

    Set frm = New FForm1

    End Sub

    Public Sub ShowModal

    frm.Show vbModal

    End Sub
    [/code]

    Then, in your other project you can add a reference to the FormClasses DLL and use it like this:

    Dim frm as FormClasses.CForm1
    frm.ShowModal

    You'll have to be careful in coding FForm1 to make sure it doesn't unload itself from memory. The class CForm1 should have complete control over the form.

  • : : Can i call it like (CALL Project1.Form1) from project2 ? ? ?
    :
    : Only if Project1 is an ActiveX project that contains a class that encapsulates a form.
    :
    : Create an ActiveX DLL project and name it FormClasses. Add a class to it named CForm1 and add a form to the project named FForm1.
    :
    : Add any of the form's properties, events, or methods that you want to use to the class.
    :
    : For example, in the CForm1 class:
    :
    : [code]
    : Private WithEvents frm as Form
    :
    : Private Sub Class_Initialize()
    :
    : Set frm = New FForm1
    :
    : End Sub
    :
    : Public Sub ShowModal
    :
    : frm.Show vbModal
    :
    : End Sub
    : [/code]
    :
    : Then, in your other project you can add a reference to the FormClasses DLL and use it like this:
    :
    : Dim frm as FormClasses.CForm1
    : frm.ShowModal
    :
    : You'll have to be careful in coding FForm1 to make sure it doesn't unload itself from memory. The class CForm1 should have complete control over the form.
    :
    :

    Methinks that that is over complicated. When you open project 2, just click Project > Add Form on the menu bar. Then find the form you want. You dont need to do it at run time. I'm pretty sure that is the solution. Dont flame me if I read the question wrong.

  • : Methinks that that is over complicated. When you open project 2, just click Project > Add Form on the menu bar. Then find the form you want. You dont need to do it at run time. I'm pretty sure that is the solution. Dont flame me if I read the question wrong.

    That's my first thought too, but he/she seemed determined to call a form residing in another project.
  • : : Methinks that that is over complicated. When you open project 2, just click Project > Add Form on the menu bar. Then find the form you want. You dont need to do it at run time. I'm pretty sure that is the solution. Dont flame me if I read the question wrong.
    :
    : That's my first thought too, but he/she seemed determined to call a form residing in another project.
    :

    Well sometimes life aint fair is it. Just add in from within VB, unless you reverse engineer Visual Basic and rewrite it in your own personal use. The latter I think is not feasible, so stick with adding it to your project before hand.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories