   Vb project crashing
  What my program currently does is connect via winsock to a remote server (im.blitbee.org 6667).The problem, is that whenever i try to close it (via the ide, or through the end command), it causes Vb6 to freeze.From the time that the winsock controll connects, it will always freeze. Every time, without fail. And it stays frozen until i terminate it with the task manager.This is on windows Xp Sp2, with Vb6.From,Nice coder   
  You will need to show us some code. And how does it freeze vb6? VB6 is a language...do you mean your program? Or do you mean your debugging it through the IDE and its freezing?   ;  Its for an msn bot that i'm making.Heres the form loaderPrivate Sub Form_Load()fpath = App.PathIf Right(fpath, 1) <> "\" Then fpath = fpath & "\"ReDim Bcs(0)ReDim bu(0)loadaimlloadmaxloadpermsBname = "Gandalf_the_grey"Winsock1.ConnectHideEnd SubAnd the main bot controll classPublic Sub aithink(email As String, usn As String, msg As String)Dim outp As StringIf UCase(msg) = ",DOWN" Then    If haspermision(email, "DOWN") Then   Form1.Winsock1.Close   DoEvents   End 'crashes here    Else   say "Ha ha, Access denied"   exit sub    End IfEnd IfStatic lastsaid As Stringoutp = aimlthink(msg)If outp = "" Then outp = maxithink(msg)learn lastsaid, msglastsaid = msgsay outpEnd SubAnd it crashes on the end. I trace it through (using the ide), and it closes the winsock controll, goes through the doeventses, then once it executes the end, it just crashes. From,Nice coder[Edited by - Nice Coder on December 11, 2005 8:13:16 PM];  My own VB app using the Winsock control works just fine, and does not cause the behaviour you describe, so here is some advice:You should practically never use 'End' to exit a VB program. Using 'End' is akin to selecting 'End Task' from the task manager. You're supposed to close it nicely by stopping all of your timers, doing any other cleanup, and closing all of your forms. When the last form closes, and the call stack is empty (all functions have returned), the app will exit gracefully.You also must be careful to take care of any reentrancy issues if you use 'DoEvents'. Never use 'DoEvents' from within a Timer either. 'DoEvents' is far too often misused by people who really don't understand the ramifications of using it.I also suggest making use of 'on error' statements, otherwise VB apps are particularly prone to falling over at the first sign of trouble.   ;  Hmmm. Interesting about the end.FOr some reson it seems to have stopped.....Maybe its because i have an array of classes?From,Nice coder   ;Quote:Original post by Nice CoderHmmm. Interesting about the end.FOr some reson it seems to have stopped.....Maybe its because i have an array of classes?From,Nice coderOh, so it's working now?I very highly recommand using Project Analyzer for any VB project. There's a link to download the evaluation copy which works on projects of up to 10 files. Honestly, it's a friggin marvelous tool. Pitty I don't use VB much nowdays.Without a tools such as the above, if you come to maintain a program which raoccasionally terminates for some unknown reason, then finding out which 'End' statement it's hitting is so hard. You can't do a search for 'End' because you'll find every 'End If' in the program.   