P
pamelafluente
Hi guys I am puzzed (???) with a probably stupid problem (VB2003). I
must be doing something dumb ...
I want to open a owned form (must *not* be mdi child) over an Mdi
Container, when the Mdi container starts.
I have a small demo program made of: Form1, Form2 (empty) and a
"StartProgram" class
which contain the following code. The startup object is set to be: Sub
Main
in case you want the source I have place a tiny file here:
http://cam70.sta.uniroma1.it/TechnicalPreview/mditrial.zip
'-----------------------------------------------------------
Public Class Form1
Inherits System.Windows.Forms.Form
'#Region " Windows Form Designer generated code "
'#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.IsMdiContainer = True
Me.WindowState = FormWindowState.Maximized
Me.ShowForm2_NonModal()
End Sub
Sub ShowForm2_NonModal()
Dim Form2 As New Form2
With Form2
.Owner = Me
.Show()
End With
End Sub
End Class
'-----------------------------------------------------------
'-----------------------------------------------------------
Public Class Form2
Inherits System.Windows.Forms.Form
'#Region " Windows Form Designer generated code "
'#End Region
End Class
'-----------------------------------------------------------
'-----------------------------------------------------------
Public Class StartProgram
Shared Function Main(ByVal Argomenti() As String) As Integer
'Get arguments
For Each Argument As String In Argomenti
MsgBox("Found command argument: " & Argument)
Next Argument
'Start main application
Dim Form1 As New Form1
With Form1
.ShowDialog()
.Dispose()
End With
'Exit returning exit code
Return 0
End Function
End Class
'-----------------------------------------------------------
So the Sub Main calles a MDI form (Form1). When the MDI form opens I
also want to open on top of it another owned (not mdi children) form
(Form2) and I want to to that in NONMODAL way.
This does not seem to work because the owned form Form2 remains blocked
in the mdi Container.
My question: How do I fix this ?
Note that: changing .ShowDialog() to would work, but I want Form2
opened in a * non * modal state.
Thank you in advance for any help,
-Pam
must be doing something dumb ...
I want to open a owned form (must *not* be mdi child) over an Mdi
Container, when the Mdi container starts.
I have a small demo program made of: Form1, Form2 (empty) and a
"StartProgram" class
which contain the following code. The startup object is set to be: Sub
Main
in case you want the source I have place a tiny file here:
http://cam70.sta.uniroma1.it/TechnicalPreview/mditrial.zip
'-----------------------------------------------------------
Public Class Form1
Inherits System.Windows.Forms.Form
'#Region " Windows Form Designer generated code "
'#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.IsMdiContainer = True
Me.WindowState = FormWindowState.Maximized
Me.ShowForm2_NonModal()
End Sub
Sub ShowForm2_NonModal()
Dim Form2 As New Form2
With Form2
.Owner = Me
.Show()
End With
End Sub
End Class
'-----------------------------------------------------------
'-----------------------------------------------------------
Public Class Form2
Inherits System.Windows.Forms.Form
'#Region " Windows Form Designer generated code "
'#End Region
End Class
'-----------------------------------------------------------
'-----------------------------------------------------------
Public Class StartProgram
Shared Function Main(ByVal Argomenti() As String) As Integer
'Get arguments
For Each Argument As String In Argomenti
MsgBox("Found command argument: " & Argument)
Next Argument
'Start main application
Dim Form1 As New Form1
With Form1
.ShowDialog()
.Dispose()
End With
'Exit returning exit code
Return 0
End Function
End Class
'-----------------------------------------------------------
So the Sub Main calles a MDI form (Form1). When the MDI form opens I
also want to open on top of it another owned (not mdi children) form
(Form2) and I want to to that in NONMODAL way.
This does not seem to work because the owned form Form2 remains blocked
in the mdi Container.
My question: How do I fix this ?
Note that: changing .ShowDialog() to would work, but I want Form2
opened in a * non * modal state.
Thank you in advance for any help,
-Pam