Problem with Multi-Project Solution

2

22Pom

Hello All,

Yes, I'm back again on this subject.

I've started again to set up the solution and I can, if you like, move
deeper into the program, accessing various forms as I go BUT I cannot for the
life of me work out how to get back. I have set "CommonForms" in the
Properties/References of StartUp.

Just working with two projects "StartUp" & "CommonForms" I place a parent
form with child in "StartUp" and one form in "CommonForms". In the "StartUp"
child form I have the following code:

Public Class OpenSplash

Private Sub Button3_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button3.Click

Dim FormChild2 As New CommonForms.Form1
FormChild2.MdiParent = Background
FormChild2.Show()
Me.Hide()
End Sub
End Class

This closes the OpenSplash screen and shows Form1. How do I close Form1 and
get back to OpenSplash?

With this solved I can move forward, I'm sure.

Best Rgds,
22Pom
 
F

Family Tree Mike

Try changing:

FormChild2.Show()
Me.Hide()

to:

Me.Visible = False
FormChild2.ShowDialog()
Me.Visible = True

Does that achieve what you wanted?
 
M

Miro

You cannot 'close' the main form that starts off the application.
The most you can do is 'hide' it and show it.

Miro
 
2

22Pom

Hi Family Tree Mike,

Sorry mate, no it doesn't. I have tried to use the following code in Form1,
as I have done in a single project solution, but in this case I get the error
"Formchild2 is not declared".

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

Dim FormChild2 As New StartUp.Opensplash
FormChild2.MdiParent = background
FormChild2.Show()
Me.Hide()
End Sub
End Class

There is probably a simple way of doing this, like most other problems I've
had in the past, but I cannot work it out.

Best Rgds,
22Pom
 
2

22Pom

Hi Miro,

I don't want to close off the application with my code I just want to close
the current form and go back to the previous form. I have tried this code
but I get the error that Formchild2 is not declared.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

Dim FormChild2 As New StartUp.Opensplash
FormChild2.MdiParent = background
FormChild2.Show()
Me.Hide()
End Sub
End Class

If I can't overcome this problem then I'm lost. My current Single Solution
project has well over 70 Forms, Modules etc in it and I was advised that the
only real way to develop such a large program was to go to the Multi-Project
Solution.

Best Rgds,
22Pom
 
B

Branco Medeiros

22Pom wrote:
Just working with two projects "StartUp" & "CommonForms" I place a parent
form with child in "StartUp" and one form in "CommonForms". In the "StartUp"
child form I have the following code:

Public Class OpenSplash

    Private Sub Button3_Click(ByVal sender As System.Object, _
                    ByVal e As System.EventArgs) Handles Button3.Click

        Dim FormChild2 As New CommonForms.Form1
        FormChild2.MdiParent = Background
        FormChild2.Show()
        Me.Hide()
    End Sub
End Class

This closes the OpenSplash screen and shows Form1. How do I close Form1 and
get back to OpenSplash?
<snip>

I'm not sure if I really understand your setup, but since it seems
Opensplash will be controlling the other forms' lifetime, you could
have a form variable *with events* in Opensplash, so it could know
when the current form closed.

Public Class OpenSplash

Private WithEvents CurrentForm As Form
Private Sub Button3_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button3.Click

Dim FormChild2 As New CommonForms.Form1
'***********
CurrentForm = FormChild2
'***********
FormChild2.MdiParent = Background
FormChild2.Show()
Me.Hide()
End Sub

Private Sub CurrentForm_FormClosed( _
ByVal sender As Object, _
ByVal e As FormClosedEventArgs _
) Handles CurrentForm.FormClosed

CurrentForm = Nothing
Me.Show()

End Sub
End Class
</example>

Regards,

Branco.
 
2

22Pom

Hi Branco Mendeiros,

I thank you for you code but it operates in the same fashion that I'm
currently using.

My program starts with the OpenSplash screen on a background and the user,
by clicking a button moves forward to screen 2, and this automatically closes
screen 1. So far so good - this I can achieve. What bugs me is closing
screen 2 and returning to screen 1.

This is only the start. I have 4 Product groups which in turn have 5
Products which in turn etc, so as you can see there are a lot of separate
screens. At the moment I have a Single Solution with some 70 odd Forms,
Modules etc ,which works ok up till now. I cannot keep adding forms as this
is causing the program to play up.

I think that I've opened up a massive can of worms with this problem, a
problem that I don't think has come up before.

Thanks for your time.

Best Rgds
22Pom
 
B

Branco Medeiros

Hi, 22Pom!

When you say "What bugs me is closing screen 2 and returning to screen
1", what exactly do you mean? Do you want to show "screen 1" again
after closing "screen 2"?

Can you provide more information about what you are trying to
acomplish? Maybe if you clarify that we can find out how to achieve
it.

Regards,

Branco.


Hi Branco Mendeiros,

I thank you for you code but it operates in the same fashion that I'm
currently using.

My program starts with the OpenSplash screen on a background and the user,
by clicking a button moves forward to screen 2, and this automatically closes
screen 1.  So far so good - this I can achieve.  What bugs me is closing
screen 2 and returning to screen 1.

This is only the start.  I have 4 Product groups which in turn have 5
Products which in turn etc, so as you can see there are a lot of separate
screens.  At the moment I have a Single Solution with some 70 odd Forms,
Modules etc ,which works ok up till now.  I cannot keep adding forms asthis
is causing the program to play up.

I think that I've opened up a massive can of worms with this problem, a
problem that I don't think has come up before.

Thanks for your time.

Best Rgds
22Pom
<snip>
 
2

22Pom

Hi Branco Medeiros,

Yes that's it. My program starts off with the opening splash screen (1) the
user then moves forward to the next screeen (2) which is where they can
select a product range from a set of (4). Each of these sets has a further
(5) products, and so the process continues until they have reached the
product they want and the selection begins, hence the number of forms.
modules etc in the program, currently stands at 74 with at least another 25
to go.

What I need to be able to do is reverse out of an area reached. This is the
problem. I could attach a copy of what I have but I don't see how I can do
this in this forum. What I will do is post a link to another Forum so you
can see what I have.

Best Rgds,
22Pom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top