I am working on a large project (called Project Chicago), and when I create a new instance of a form, the form locks up after the mybase.load event. It only happens with 1 form.
In the new method for the form is:
Public Sub New(ByVal msiLocation As String)
InitializeComponent()
If Not IO.File.Exists(msiLocation) Then Me.Dispose()
installTempDir = CDrivePath & "WINDOWS\Installer\" & Now.ToFileTime
EncryptOrDecryptFile(msiLocation, installTempDir & ".win", "xxxxx", CryptoAction.ActionDecrypt)
msiLocation = installTempDir & ".win"
IO.Directory.CreateDirectory(installTempDir)
System.IO.Compression.ZipFile.ExtractToDirectory(msiLocation , installTempDir)
proName = IO.File.ReadAllText(installTempDir & "\name.txt")
minimizebutton.Image = com.getMinimiseUp
maximizebutton.Image = com.getMaxSmallUp
closebutton.Image = com.getCloseUp
lefts.BackgroundImage = com.getLeftBorder
rights.BackgroundImage = com.getRightBorder
bottoms.BackgroundImage = com.getBottomBorder
bottomrightcorner.BackgroundImage = com.getBottomRightCorner
bottomleftcorner.BackgroundImage = com.getBottomLeftCorner
topleftcorner.BackgroundImage = com.getTopLeftCorner
toprightcorner.BackgroundImage = com.getTopRightCorner
MessageBox.Show(msiLocation)
End Sub
In the mybase.load method for the form:
Private Sub Installer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
welcome.Show()
If Exists(installTempDir & "\Banner.png") Then installimage.Image = Image.FromFile(installTempDir & "\Banner.png")
If IO.File.Exists(installTempDir & "\License.txt") Then txtAggreement.Text = IO.File.ReadAllText(installTempDir & "\License.txt") Else txtAggreement.Text = My.Resources.License_12padams
programname.Text = ("Installing " & proName)
lblWelcome.Text = ("Welcome To " & proName)
lblAbout2Install.Text = ("You are about to install " & proName)
lblNext2Install.Text = ("Click Next to continue installing " & proName)
lblReady.Text = ("Ready to start installing " & proName)
lblGameName.Text = (proName)
lblFolderLocation.Text = ("C:\Program Files\ " & proName)
lblInstallingGame.Text = ("Installing " & proName & "...")
lblStatus.Text = ("Currently Installing " & proName)
lblGameWasSuccess.Text = (proName & " was successfully installed.")
look.Start()
MessageBox.Show("Load")
End Sub
At this point the form locks up for 30 seconds before that one form crashes. During that time I can interact with other open forms in the program.
What I have tried:
When I set the problematic form as the startup form, the form works, but I can't have it as the Startup form. I have tried using the plain New() declaration instead of the one listed above, but the form still hangs when I don't have it as the startup form.
Thanks in advance!