load (call?) a form from projet1 in project2

  • Thread starter Thread starter Pascal
  • Start date Start date
P

Pascal

hello
How to load (call?) a form from projet1 in project2 when a solution is made
of several projects.
thanks
pascal
 
Just set a reference to project 1 in project 2 ( choose tab project
reference) declare object pointer to the specific form (
NameSpacename.FrmClsname )
and do with it whatever you want


HTH

Michel
 
hello
How to load (call?) a form from projet1 in project2 when a solution is made
of several projects.
thanks
pascal
--http://www.scalpa.infohttp://scalpa98.blogspot.com/http://scalpa-production.blogspot.com/

Assuming you have 2 projects in your solution(can be added File->Add
menu) and Project1 must call Project2's form which is in the same
solution as a seperate project.

Well, first right click on the caller project(Project1) in solution
then choose "Add Reference", in "Projects" tab, add reference to the
other project (that is Project2) that you want to call its form.

When done, you can import second project to first project and
instantiate its form to call under your main project(project1) that is
in the same solution like this:

Dim instance As New Project2.Form1
instance.Show()

Hope this helps,

Onur Güzel
(e-mail address removed)
(e-mail address removed)
 
Thanks everyone : it works now, but i can't do the same from project2 to
project1... How to call back the first form ?

this code works in Frm_main_mdi.vb
Private Sub OrdonnerToolStripMenuItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles OrdonnerToolStripMenuItem.Click
Me.Hide()
Try
Dim frmOrdonner As New ordonner.FrmMain
frmOrdonner.ShowDialog()
Catch ex As ApplicationException
MsgBox("Impossible d'ouvrir la fenêtre", MsgBoxStyle.Critical,
"Oops!")
End Try
End Sub

but in frmOrdonner.vb , that doesn't work : How to call back the first form
?
I tried to make a reference to it but an error tells me there is a circular
reference !(or something like this)

Private Sub FrmMain_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Frm_main_mdi.Show()'error her
End Sub


thanks for help
pascal
--
http://www.scalpa.info
http://scalpa98.blogspot.com/
http://scalpa-production.blogspot.com/

"kimiraikkonen" <[email protected]> a écrit dans le message de
hello
How to load (call?) a form from projet1 in project2 when a solution is
made
of several projects.
thanks
pascal
--http://www.scalpa.infohttp://scalpa98.blogspot.com/http://scalpa-production.blogspot.com/

Assuming you have 2 projects in your solution(can be added File->Add
menu) and Project1 must call Project2's form which is in the same
solution as a seperate project.

Well, first right click on the caller project(Project1) in solution
then choose "Add Reference", in "Projects" tab, add reference to the
other project (that is Project2) that you want to call its form.

When done, you can import second project to first project and
instantiate its form to call under your main project(project1) that is
in the same solution like this:

Dim instance As New Project2.Form1
instance.Show()

Hope this helps,

Onur Güzel
(e-mail address removed)
(e-mail address removed)
 
Pascal said:
Thanks everyone : it works now, but i can't do the same from project2 to
project1... How to call back the first form ?

this code works in Frm_main_mdi.vb
Private Sub OrdonnerToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
OrdonnerToolStripMenuItem.Click
Me.Hide()
Try
Dim frmOrdonner As New ordonner.FrmMain
frmOrdonner.ShowDialog()
Catch ex As ApplicationException
MsgBox("Impossible d'ouvrir la fenêtre", MsgBoxStyle.Critical,
"Oops!")
End Try
End Sub

but in frmOrdonner.vb , that doesn't work : How to call back the first
form ?
I tried to make a reference to it but an error tells me there is a
circular reference !(or something like this)

Private Sub FrmMain_FormClosing(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Frm_main_mdi.Show()'error her
End Sub


thanks for help
pascal
--
http://www.scalpa.info
http://scalpa98.blogspot.com/
http://scalpa-production.blogspot.com/

"kimiraikkonen" <[email protected]> a écrit dans le message de


Assuming you have 2 projects in your solution(can be added File->Add
menu) and Project1 must call Project2's form which is in the same
solution as a seperate project.

Well, first right click on the caller project(Project1) in solution
then choose "Add Reference", in "Projects" tab, add reference to the
other project (that is Project2) that you want to call its form.

When done, you can import second project to first project and
instantiate its form to call under your main project(project1) that is
in the same solution like this:

Dim instance As New Project2.Form1
instance.Show()

Hope this helps,

Onur Güzel
(e-mail address removed)
(e-mail address removed)

Perhaps what you need is a 3 project solution. Seems as if you have common
components from each of two executables.

Create a solution with the 2 executable projects and 1 class library which
will contain the forms and classes that are common between the 2
executables. Then you reference the class library in the 2 executable
projects.

This is a beter solution I think since you have common functionallity
between programs.

LS
 
Back
Top