Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.ShowDialog

Status
Not open for further replies.

SiJP

Programmer
May 8, 2002
708
GB
I'm having a problem displaying a Modal form. Using the code below, the form I intend to open as modal seems to open then close immediately.

frmMain is created as follows:
Code:
Public Shared oMainForm As New frmMain 'in class module

Sub Main(ByVal cmdArgs() As String)
    oMainForm.Show()
    Application.Run()
End Sub

frmMain has a menu item that has code as follows, to open frmDialog:

Code:
    Dim oForm As New frmDialog
    oForm.ShowDialog()

Why, using the above code, does frmDialog open the close immediately?

Thanks,

------------------------
Hit any User to continue
 
SiJP, just to make sure we're on the same page, make a new project with this code:
Code:
Public Sub Main
  dim f as new form
  f.show
end sub

Then change it to this code:
Code:
Public Sub Main
  dim f as new form
  f.showdialog
end sub

The first block of code will flash the form then end. The second will display the Form and end when the form is closed.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top