unwanted default-style form at end of execution

  • Thread starter Thread starter Loane Sharp
  • Start date Start date
L

Loane Sharp

Hi there

When I run the following code (excerpts shown) the form frmSync shows,
controls on the form update well while the procedures run, and the code
executes perfectly ... except at the very end, when another unwanted form
pops up (unlike my richly formatted form, the unwanted form is of the
default kind that you would get simply from "frmSync = New Form()" followed
by "frmSync.Show()").

Any ideas why this might be so? (I don't remember getting this result when I
worked with MyBase and Me.)

Best regards
Loane

Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports System.IO
Imports System.Net

Public Class synchronize

Inherits System.Windows.Forms.Form

[some declarations here]

Shared Sub Main()
Application.Run(New synchronize())
End Sub

Public Sub New()
frmSync = New Form()

[some code and form formatting here]

frmSync.Show()
Application.DoEvents()
End Sub

End Class
 
Remove the .Show and DoEvents lines from the constructor. The fom is showing
itself at the moment of construction and bypassing the Application.Run call
entirely.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Back
Top