OK, unfortunately I have a problem.
As I said this works, but now the form2 is not recognized as an mdichild of
the container form. I tried to instantiate it in the conainer load event.
But that gives me some wierd behavior. What happens is that when I call
form 2 from form1, as soon as I complete some task in form 2 it returns to
form1 without asking. Here is the code in FormContainer:
Private Sub FormContainer_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' ***********This is your code
If Not IsNothing(L3GlobalModule.frmSliceInfo) AndAlso
L3GlobalModule.frmSliceInfo.Visible = False Then 'This applies after form
has been closed
L3GlobalModule.frmSliceInfo = Nothing '(frmSliceInfo does not test
as nothing after being closed)
L3GlobalModule.frmSliceInfo = New FormSliceInfo
L3GlobalModule.frmSliceInfo.Show()
ElseIf IsNothing(L3GlobalModule.frmSliceInfo) Then 'This applies first
time form is opened
L3GlobalModule.frmSliceInfo = New FormSliceInfo
L3GlobalModule.frmSliceInfo.Show()
Else 'This applies if form is visible and user clicks the button on
Form1 again
L3GlobalModule.frmSliceInfo.BringToFront()
L3GlobalModule.frmSliceInfo.WindowState = FormWindowState.Maximized
End If
' ***********This is your code
L3GlobalModule.frmSliceInfo.MdiParent = Me
L3GlobalModule.frmSliceInfo.Location = Me.Location
L3GlobalModule.frmSliceInfo.Size = Me.Size
L3GlobalModule.frmSliceInfo.Dock = DockStyle.Fill
frmMain.MdiParent = Me
frmMain.Location = Me.Location
frmMain.Size = Me.Size
frmMain.Dock = DockStyle.Fill
'************************
......
Now in FormMain, I have a button called AdvancedPrice:
Private Sub btnAdvancedPrice_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdvancedPrice.Click
' ***********This is your code
If Not IsNothing(L3GlobalModule.frmSliceInfo) AndAlso
L3GlobalModule.frmSliceInfo.Visible = False Then 'This applies after form
has been closed
L3GlobalModule.frmSliceInfo = Nothing '(frmSliceInfo does not test
as nothing after being closed)
L3GlobalModule.frmSliceInfo = New FormSliceInfo
L3GlobalModule.frmSliceInfo.Show()
ElseIf IsNothing(L3GlobalModule.frmSliceInfo) Then 'This applies first
time form is opened
L3GlobalModule.frmSliceInfo = New FormSliceInfo
L3GlobalModule.frmSliceInfo.Show()
Else 'This applies if form is visible and user clicks the button on
Form1 again
L3GlobalModule.frmSliceInfo.BringToFront()
L3GlobalModule.frmSliceInfo.WindowState = FormWindowState.Maximized
' ***********This is your code
In FormSliceInfo, I am having the user pick a text file, I then read it and
fill a multiline text box with it. As soon as I read the file it goes back
to FormMain. I stepped through it and saw that it was doing so as soon as
the textbox was filled.
What is going on? Please help, I am flummoxed!
Thanx,