forms not closing or still show as an open process
Okay so I have a game launcher written in VB.NET, which includes file
security as a separate form which opens before the launcher itself, well
sometimes if I get an error like unable to patch because my patch version
file is for some reason incorrect, it will close, but stays open in task
manager as a process running at about 25-50+% CPU, I have been using
Application.Exit for any closing commands, I have replaced the patch error
message box like the following
If patchVer = latest Then
Form1.Label1.Text = "No New Updates"
ElseIf patchVer > latest Then
MessageBox.Show("Error in patch Version, deleting patch.txt.")
Try
If IO.File.Exists("patch.txt") Then
IO.File.Delete("patch.txt")
Application.Exit()
End If
Catch ex As Exception
End Try
End If
The original code is like this.
If patchVer = latest Then
Form1.Label1.Text = "No New Updates"
ElseIf patchVer > latest Then
MessageBox.Show("Error in patch Version. Repatching Now")
Try
Functions.finishedLaunching()
If IO.File.Exists("patch.txt") Then
IO.File.Delete("patch.txt")
End If
Application.Restart()
Catch ex As Exception
MessageBox.Show("Can not repatch.")
Application.Exit()
End Try
End If
another problem would be if the patch.txt file was higher than the actual
patch version, MessageBox.Show("Error in patch Version. Repatching Now")
loops over and over after Application.Restart() and each time you click OK
it closes but leaves behind a process, adding a process each time you do
this.
No comments:
Post a Comment