I want to load a form of project2 on click event of form of project1.
how to do this?need answer urgently......

Recommended Answers

All 2 Replies

To open a form of another project, you need to reference the project 2 in project 1. For that, you need to rebuild the entire

solution to create the exe file of Project 2 available in the bin folder. Then you need to add the references of the Project 2 exe in the Project 1.

We will also have to import the project 2 namespace in our project 1 using Import keyword.

Imports Project2

Then lets say on a button click, you may use the following code:

Dim frm As New Project2.Form1

    frm.ShowDialog()

I hope this will help.

You need to reference your project in project 1. Go to 'Project - Referneces and select vbpProject2 (or whatever your second project is called) and add the reference.

From Project1 add the following where you want to call the project 2 form -

Dim objNewForm as Form

objNewForm = New Project2.Form2

objNewForm.SHow()

Happy coding

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.