how can you prevent this?

When I am running a program, I didnt use opengl codes yet and quitted a program. Then I got error message:An unhandled exception of type ‘CsGL.Util.NativeException’ occurred in csgl.dll. It works fine if I am using opengl codes. Do you know how to prevent this? If you do, please explain this why it did happen?

If you’re getting an error about that specific dll file, then you’re probably using Nvidia’s CG language. See if you’re ever initializing it in your code, if you are, take it out and your program should run fine.