I´ve been all morning (portugal) struggling with this problem and I´ve
figured it out... Now I know this behaviour comes from the public
declared "floating panels" mentioned above... I've tried it with this
simple code with 2 forms and one module (module 1,form2 and form3):
MODULE 1
Module Module1
Public objForm2 As New Form2
Public objForm3 As New Form3
Sub main()
Application.Run(New Form2)
End Sub
End Module
--------------------------------------------------------------------
FORM 2
Public Class Form2
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Panel1 = New System.Windows.Forms.Panel
Me.Panel2 = New System.Windows.Forms.Panel
Me.Button1 = New System.Windows.Forms.Button
Me.Panel1.SuspendLayout()
Me.Panel2.SuspendLayout()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.BackColor =
System.Drawing.SystemColors.ActiveCaption
Me.Panel1.Controls.Add(Me.Panel2)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(784, 398)
Me.Panel1.TabIndex = 0
'
'Panel2
'
Me.Panel2.BackColor = System.Drawing.Color.Red
Me.Panel2.Controls.Add(Me.Button1)
Me.Panel2.Location = New System.Drawing.Point(128, 56)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(464, 248)
Me.Panel2.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(160, 88)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(784, 398)
Me.Controls.Add(Me.Panel1)
Me.Name = "Form2"
Me.Text = "Form2"
Me.Panel1.ResumeLayout(False)
Me.Panel2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Panel1.Controls.RemoveAt(0)
Panel1.Controls.Add(objForm3.Panel1)
End Sub
End Class
---------------------------------------------------------------------
FORM 3
Public Class Form3
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Panel1 = New System.Windows.Forms.Panel
Me.Button1 = New System.Windows.Forms.Button
Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.BackColor = System.Drawing.Color.Firebrick
Me.Panel1.Controls.Add(Me.Button1)
Me.Panel1.Location = New System.Drawing.Point(64, 40)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(560, 272)
Me.Panel1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(224, 96)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form3
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(680, 357)
Me.Controls.Add(Me.Panel1)
Me.Name = "Form3"
Me.Text = "Form3"
Me.Panel1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
objForm2.Panel1.Controls.RemoveAt(0)
objForm2.Panel1.Controls.Add(objForm2.Panel2)
End Sub
End Class
Try this please....
When you press the button on form 3 you can see that you can't close
the form in the right sided corner X button, and nothing happens...
It seems like in Form2 I can add the objForm3.panel1 to its
controls...But in Form 3 I can't add its controls objForm2.panel2 ...
Why? Am I thinking in a wrong way? Certainly...
There is any kind of way to add and remove panels in ã main form as
the user interacts clicking, but the panels having possibility to
handle objects of other panels... A little bit confusing!!!
Thanks in advance
su******@hotmail.com (?scar Martins) wrote in message news:<22**************************@posting.google. com>...
I'm using VS.NET 2003 vrs 7.1.3008.
I must say that if I don't have any breakpoint the app behaves
normal(not always). Just when I put a breakpoint it assumes always
that described behaviour...
In my application I have a project with a main form and 2 forms with
one panel each... I also have a module (startup) which has declared
the 3 forms as public. This module instanciates and runs the main
form... This main form as a sector(panel) which it´s filled with a
default panel... When I press a toolbar button the main form removes
the default panel and adds the sector(panel) the respective
panel(instanciating the form if 1rst time added). So far I have just 2
panels as mentioned above. Then, Some events make the panels be
removed and added as the user interacts...
I think the behaviour of the app may be caused by this kind of
"floating panels" that are all publics (the forms) and which one
accesses the database everytime with its own private DB access
object.... Or no??
I'm thinking about to reinstall the VS.net because I can't debug the
app and trace the objects behaviour and its values....
I'm stuck..
Thanks
"One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> wrote in message news:<#c**************@TK2MSFTNGP09.phx.gbl>... More than likley its bad code, what version are u using ?
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me
Time flies when you don't know what you're doing
"?scar Martins" <su******@hotmail.com> wrote in message
news:22**************************@posting.google.c om... Hi
When I'm debugging and somewhere in the code I have a breakpoint, many
times when the code after breakpoint finishes and the app returns I
can do nothing within in it(it's like freeze)... The app behaves
strangely and not accepts any event even close event!!!!! It just
lefts for me to stop debugging clicking the respective button in the
vs.net toolbar... I don't know if this behaviour is a bug of vs.net or
if it's consequence of bad code ... But if would be bad code I think
it should stop with any kind of error...
Did anybody experienced something like this??
Thanks in advance