Show and Show Dialog 
Author Message
 Show and Show Dialog

Hi:

    I am having difficulties using show and showdialog.  I
have to always start by using showdialog and then switch
to show.  Why can't I just use show?  When I try to use
show it disappears as soon as it appears.  If I use show
dialog it shows and stays as it should but because it is
modal I cannot have two forms appear and stay on the
screen at the same time.  Would someone please explain
this to me and write a short example of how to use the
modeless show.

Thanks,

Rachel



Thu, 20 Oct 2005 09:48:26 GMT  
 Show and Show Dialog

Quote:

> Hi:

>     I am having difficulties using show and showdialog.  I
> have to always start by using showdialog and then switch
> to show.  Why can't I just use show?  When I try to use
> show it disappears as soon as it appears.  If I use show
> dialog it shows and stays as it should but because it is
> modal I cannot have two forms appear and stay on the
> screen at the same time.  Would someone please explain
> this to me and write a short example of how to use the
> modeless show.

> Thanks,

> Rachel

Hi, Rachel,

You need to hide your original form if you dont want it there.
say you have Form1 and Form2. You want to call Form2 from Form1 and
then Form1 close after the Form2 is called using show or showdialog
then the sample code will be sth like:

 dim frmshow as new Form2()
frmshow.show 'or frm1.showDialog
me.hide()

Then the Form1 will be still running in the background, You need to
add a button or menu to exit out the whole application in Form2 by
calling application.exit.(Because when you close the Form2 by using x
, it only closes the Form2, Form1 is hiding so you are not able to see
and close it)

I guess you use sth like this:

drm frmshow as new Form2()
frmshow.show
me.close

In that way, Form1 will close you are not able to call Form2 so the
Form2 will disappear as soon as it appears. Change the me.close to
me.hide should slove this problem.

HTH,

Irene



Thu, 20 Oct 2005 22:33:19 GMT  
 Show and Show Dialog

Quote:
>     I am having difficulties using show and showdialog.  I
> have to always start by using showdialog and then switch
> to show.  Why can't I just use show?  When I try to use
> show it disappears as soon as it appears.  If I use show
> dialog it shows and stays as it should but because it is
> modal I cannot have two forms appear and stay on the
> screen at the same time.  Would someone please explain
> this to me and write a short example of how to use the
> modeless show.

Did you read the answers you got from Ken and Chris some days ago? If there
are follow-up questions, please stay in the same thread.

Please show us some code where and how you show the forms.

--
Armin



Thu, 20 Oct 2005 23:23:00 GMT  
 Show and Show Dialog
I just added 2 additional forms into project and placed 2 buttons on Form1.
Full code in Form1:

Public Class Form1
Inherits System.Windows.Forms.Form
Private frm2 As Form2
Private frm3 As Form3

#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 Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.De{*filter*}StepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(52, 228)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(156, 228)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 1
Me.Button2.Text = "Button2"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
    frm2 = New Form2
    frm2.Show()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
    frm3 = New Form3
    frm3.Show()
End Sub

End Class

In Form2 and Form3 I wrote nothing.
Everything works fine
Vlad


Quote:
> Hi:

>     I am having difficulties using show and showdialog.  I
> have to always start by using showdialog and then switch
> to show.  Why can't I just use show?  When I try to use
> show it disappears as soon as it appears.  If I use show
> dialog it shows and stays as it should but because it is
> modal I cannot have two forms appear and stay on the
> screen at the same time.  Would someone please explain
> this to me and write a short example of how to use the
> modeless show.

> Thanks,

> Rachel



Fri, 21 Oct 2005 04:23:40 GMT  
 Show and Show Dialog
Rachel,

If you want the form that you are showing with the Show command to stay on
top, set the form's TopMost property to True. Otherwise your new form will
always get bumped to behing the active form.

Cheers,
Lubos


Quote:
> Hi:

>     I am having difficulties using show and showdialog.  I
> have to always start by using showdialog and then switch
> to show.  Why can't I just use show?  When I try to use
> show it disappears as soon as it appears.  If I use show
> dialog it shows and stays as it should but because it is
> modal I cannot have two forms appear and stay on the
> screen at the same time.  Would someone please explain
> this to me and write a short example of how to use the
> modeless show.

> Thanks,

> Rachel



Fri, 21 Oct 2005 05:53:29 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to show toolbar before form is shown

2. Showing inactive windows on top or showing always...

3. Showing inactive windows on top or showing always...

4. Print shows blank fields, Preview shows actual data

5. Query ony showing *(All Columns) no columns are shown

6. ADO Updates to SQL Server not Showing, though records affected shows true

7. showing a from dynamically - "frmSample".show ?

8. Showing detail view in Common Dialog Box

9. Access equivalent of Dialogs(wdDialogFileOpen).Show

10. Showing ODBC connect string creation dialog

11. How do I NOT show an ODBC dialog box

12. Group Dialog Box Won't show up....

 

 
Powered by phpBB® Forum Software