Advertisement

06.09.2008 at 11:38AM PDT, ID: 23470056
[x]
Attachment Details

While unloading a form using set frm = nothing the form reloads any ideas why?

Asked by eneate in Visual Basic Programming

Tags:

Hi

I have several routines to unload an application. The main window is called frm_toolbar. All unloaded fine until I added a timer, I've added code to close the timer before unloading the form and this appears to work ok. But the main form is not unloading, it appears to close but is still running in the background.

If I add set frm_toolbar = nothing the form closes then reloads, if I then clock close it closes and unloads fine. Here is the code I use to initiate the close routines

If unload_main = True Then
Cancel = 0
Else
Cancel = 1
End If

Any ideas appreciated, this is a tricky one.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
this is the unload main reoutine. it closes a couple of folders, exits the loop via a exitloopas boolean variable
 
Source = frm_toolbar.Label3.Caption
 
'write the current preset calibration value to the ini file
 
preset_cal = frm_toolbar.txtprecals.text
 
Call WritePrivateProfileString("Calibration", "Pre_set", preset_cal, filename)
Call WritePrivateProfileString("Calibration", "source", Source, filename)
 
'delete the temporary file in the application data folder
 
If IspathExist(temp_folder) Then
 
Dim fso As New FileSystemObject
Set fso = CreateObject("Scripting.FileSystemObject")
fso.GetFolder (temp_folder)
fso.DeleteFolder (temp_folder), False
 
'Kill temp_folder
End If
 
'delete the temporary file in the application data folder
 
If IspathExist(temp_folder2) Then
 
Set fso = CreateObject("Scripting.FileSystemObject")
fso.GetFolder (temp_folder2)
fso.DeleteFolder (temp_folder2), False
 
End If
 
 'close the open version of image pro
 
AppActivate image_pro
  Wait 1
SendKeys "%{F4}", True
Wait 0.1
 
    exitloop = True
    frm_toolbar.Timer1.Interval = 0
    frm_toolbar.Timer1.Enabled = False
 
 
 'ensure that all the form have been unloaded
 
 Dim i As Integer
   For i = Forms.count - 1 To 0 Step -1
      Unload Forms(i)
      Set Forms(i) = Nothing
   Next
   
Exit Function
 
Loading Advertisement...
 
[+][-]06.09.2008 at 12:02PM PDT, ID: 21745681

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 12:33PM PDT, ID: 21745921

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.09.2008 at 02:59PM PDT, ID: 21746981

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Visual Basic Programming
Tags: visual basic
Sign Up Now!
Solution Provided By: cool12399
Participating Experts: 3
Solution Grade: B
 
 
[+][-]06.09.2008 at 07:30PM PDT, ID: 21748087

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628