End a Program, Given only its Window Caption
Version Compatibility: Visual Basic 6, Visual Basic 5
Another function on the site, http://www.freevbcode.com/ShowCode.Asp?ID=935, shows how to immediately and unconditionally terminate an appication. The advantage of using the method presented here is that it allows the application to exit gracefully, without problems such as data loss.
Instructions: Copy the declarations and code below and paste directly into your VB project.