|
-
Feb 1st, 2000, 04:19 PM
#1
Thread Starter
Hyperactive Member
-
Feb 1st, 2000, 05:16 PM
#2
Frenzied Member
Since you have no forms open you should be able to just use End to stop the program running.
------------------
Mark "Buzby" Beeton
VB Developer
[email protected]
-
Feb 2nd, 2000, 08:25 PM
#3
Thread Starter
Hyperactive Member
Thank You 
------------------
On Error Goto Bed :0)
[email protected]
-
Feb 2nd, 2000, 11:45 PM
#4
Member
You should NEVER use the End statement in your code !!!!!!!!!
I suppose you have a MSComm control on a form to communicate with the PLC.
When you access the properties or methods of the MSComm control, the form it is placed on is loaded (but not shown)!
Therefore you have to unload that form and when all forms are unloaded, the program will end by itself !!!
-
Feb 3rd, 2000, 07:05 PM
#5
Thread Starter
Hyperactive Member
Hello Fredrik
Im not usin MScomm in my app, its using a DLL that was shipped with the PLC (SIOX) and the first thing I do is trying to initiate the serial com-port to communicate with the SIOX.
If this initiation fails then it return an error and its here I wanna show a msgbox and then Exit my app.
What do you suggest I use if the initiation fails, since no forms are loaded yet?
I need to make sure that my app is totaly unloaded from the memory.
------------------
On Error Goto Bed :0)
[email protected]
-
Feb 3rd, 2000, 08:07 PM
#6
Member
When there are no forms loaded into memory and your application reaches the end sub line of your Sub Main routine, the application should terminate automatically.
When this is not the case, this means that there must be loaded something into the memory.
This is the case when you access f.ex. a control's properties:
The control is places on a form and when you access its properties, the form is automatically loaded.
So you should check if there is anything loaded.
A way to check this is to write something (MsgBox "Form Loaded") in the Form_Load event of each form.
Like this, a message box appears each time a form is loaded.
When you notice that a form is loaded, you can implicitly unload the form by the command 'unload FormName'
[This message has been edited by Frederik Gekiere (edited 02-04-2000).]
-
Feb 6th, 2000, 03:30 PM
#7
Thread Starter
Hyperactive Member
OK
Lets see if I got this right.
I should check for the return value of the initiate function and If no error is returned then I should carry on with my startup tasks Else I should let the program do nothing after the end if and then it WILL
terminate itself leaving nothing in the memory when it reaches End Sub. 
OK that is great if it works that way, but now my boss has decided that if we get an error in return in the initiate secuense than we will start another demoApp and "unload" the main app.
How will this affect my program, will it still "unload" my App when it reaches the end sub line, since it have not loaded any forms yet?
The demoApp is located in another directory.
Thank you
------------------
On Error Goto Bed =:0)
[email protected]
[This message has been edited by onerrorgoto (edited 02-07-2000).]
-
Feb 6th, 2000, 03:46 PM
#8
Member
When you start the other application (I guess that will be by using the Shell function ??) and your program reaches End Sub, normally your program should stop while the other program (the one started with the shell function) continues running.
You should check it out yourself by testing it ...
You can see in the task manager which programs are running.
When your program has stopped running, all memory resources used by the program will automatically be cleared.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|