Question Multi-Project Solution Problem

Tarablue

Member
Joined
Oct 11, 2008
Messages
6
Programming Experience
3-5
Hi All,

I have tried to get answers on different forums so some of you may have already seen this before.

What I have is a Single Solution with 2 Class Libraries. In ClassLibrary 1 I have 2 Forms, Background and OpenSplash. Background is an MDIParent and OpenSplash a Child with a Button. In Background I have the following code;

Public Class Background
Private Sub Background_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load

Dim ChildForm As New OpenSplash
ChildForm.MdiParent = Me
ChildForm.Show()

End Sub
End Class


and in OpenSplash I have the following code;

Public Class OpenSplash

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

Dim Form1 As New ClassLibrary2.Form1

form1.MdiParent = Background
form1.Show()
Me.Hide()

End Sub
End Class


ClassLibrary2 has a single form Form1 with a Button.

Now when I run this and click the Button on OpenSplash that form dissapears and Form1 is shown. What I cannot seem to be able to do is click the Button on Form1 and for that to close/hide and OpenSplash to show up again.

I have also tried to do this with a Single Solution that has 2 Projects instead of Class Libraries, but still cannot get it to work.

This is the part where I need help. I'm sure that there is a solution to this problem so if anyone can offer some code that will do this operation I would be extreemly appreciative.


Best Rgds,
Tarablue
 
Hello Booby,

OK I've changed Private Sub Background_Load to Public Sub Background_Load, if this is what you mean, but I'm still lost as to how to call it from the Close/Click event. I try to Dim OpenSplash but keep gettings errors that it is not declared.

Can you please expand on this for I'm not sure what I'm really doing here.

Best Rgds,
Dave R
 
No, that's not what I meant. Declaring Event-Handlers as Public is somehow...messy.

VB.NET:
Public Class Background
      Private Sub Background_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.openSplash()
      End Sub

      Public Sub openSplash()
            Dim ChildForm As New OpenSplash
            ChildForm.MdiParent = Me
            ChildForm.Show()
      End Sub
End Class

Then you should be able to call it with BackGround.openSplash().

Bobby
 
Hi Bobby,

Still keep getting the "Not Declared" error in Form1 Button Click event. This is whats bugging me, you get so far but just can't fall over the line.

Best Rgds,
Dave R
 
Back
Top