How to invoke a Form from Different Project?

Hi,
 
I have a situation with multiprojects created using VS IDE with different namespaces as mentioned here. I first created a windows application with the name App1 and i created another new project with name App2 and added to the exisiting project. ie., App1
 
Now, all i want is how can i call the Form1 of App2 in some event of Form1 of App1
 
Regards,
DSK Chakravarthy



Answer this question

How to invoke a Form from Different Project?

  • NimeshPatel

    David,

    Thanks for your post, but i do that just to draw attention from different forums. Any how, you statement seems meaningfull.

    Henceforth, I'll consider this.

    Regards

  • DavidNJ

    Hi,

    you can make a dll out of your App1 and Add it to your Project References. Then youu can use the classes of App1 but you have to ship the dll with your Application.

  • Beaulieu

    Hi DSK,

    You would need to qualify the Form1 class with the namespace after having added a Project Reference to App2 in App1 Project.

    The code snippet below shows declaring a Form1 class of App2 application within App1 Project's Form1 eventhandler.

    ---------------------------------------------------
    CODE SNIPPET
    ---------------------------------------------------
    private void Form1_Load(object sender, EventArgs e)
    {
       App2.Form1 objForm1 = new App2.Form1();
       objForm1.Show();
    }
    ---------------------------------------------------

    Regards,
    Vikram



  • Kajit

    Cross-Posted Question - Already answered here:
    http://forums.microsoft.com/msdn/ShowPost.aspx PostID=6669


    Regards,
    Vikram

  • numberonesuperguy

    Hi Chakrawarthy,

    I assumed you had meant a ClassLibrary for App2. In .NET v1.1 and .NET v1.0 its not possible to add add a .EXE file as reference. I tried however in v2.0 and in VS2005 Beta, it allowed me to add another .EXE as a reference.

    I was able to compile and it worked as well with another .EXE as a dependency.

    Regards,
    Vikram


  • Scafe

    Cross-Posted Question - Already answered here:
    http://forums.microsoft.com/msdn/ShowPost.aspx PostID=6669


    Regards,
    Vikram

  • Michela

    I merged all of these threads rather than deleting them since multiple answers where given.

  • Mujeeb_rahman

    This should work. Set a reference to App2 and then in your event in App1.

    Assuming App2 is your namespace in the second app...

    App2.Form1 form = new App2.Form1()
    form.Show


  • mmc071

    DSK,

    Please do not cross-forum post. You have posted the same question in 5 different forums.

    Be patient, someone will eventually help you. So there is not reason to do that. In fact it makes people less likely to help you.



  • How to invoke a Form from Different Project?