I have narrowed it down to the form in my program that is used to set the settings. On the sub new() I added the following code:
Dim ts = New TimeSpan(Now.Ticks) InitializeComponent() Dim newts As New TimeSpan(Now.Ticks - ts.Ticks) MessageBox.Show(newts.TotalSeconds)
This initialization takes over 6 or 7 seconds to run, causes the entire program to freeze and the task manager spikes to 600,000 k for the process. After it popups up the message box with the time, the task manager memory for the process drops to 20,000 k and everything is back to working like normal.
This only happens the FIRST time the settings window is opened. All subsequent times it opens almost instantly. I thought that would mean something is being initialized the first time and not the others. Each time the settings window is opened the object is set to a new instance of the form.
If openSettings = True Then openSettings = False If Not (settingsOpen) Then settingsOpen = True newSettingsForm = New frmSettings '6.30 seconds? newSettingsForm.Show(userAccounts.getAccounts) '0.04 seconds Else newSettingsForm.Focus() End If End If
I don't think it is any of the variables that are initialized as they are all pretty basic. I would really like some direction on what to look for to fix this, please.