|
-
Jul 12th, 2000, 01:47 PM
#1
Thread Starter
Member
Hello. I'm using vb5 professional edition and whenever my program terminates, the entire vb design environment terminates with it! No errors are being generated within my program. It's is accessing a DLL. Here is the code:
Option Explicit
Dim session As Object
Private Sub cmdLogon_Click()
On Error GoTo logon_error
If txtServer.Text = "" Or txtUser.Text = "" Or txtPass.Text = "" Then
MsgBox "Please input server, user and password."
Else
session.CTLogon txtServer.Text, txtUser.Text, txtPass.Text
End If
Exit Sub
logon_error:
MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description
Err.Clear
Exit Sub
End Sub
Private Sub Form_Load()
Set session = CreateObject("CTI.Session.1")
End Sub
Private Sub form_terminate()
Set session = Nothing
End Sub
-
Jul 12th, 2000, 02:57 PM
#2
Lively Member
I don't know about VB5, but I've found that in VB6, inside the Terminate event, the form has already been destroyed, along with the object representing it.
Private Sub form_terminate()
Set session = Nothing
End Sub
Therefore, when your form_terminate() is called, there is no form anymore. At this point, 'session' is not accessible. In VB6, as soon as you refer to Session, a new copy of the form is automatically created and its Session variable is set to Nothing. My guess is that in VB5, the new form is NOT created and the Session reference therefore crashes VB.
Solution: Never use Form_Terminate(). Do all your unload processing in Form_Unload.
- Steve
Real programmers use COPY CON PROGRAM.EXE
-
Jul 12th, 2000, 03:10 PM
#3
Thread Starter
Member
That didn't solve my problem. Even if I set session = nothing before the form unloads, all of vb blows up.
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
|