when you hit the X button on the very top right, next to the minimize button i need the program to end.
i know i did this the completly wrong but heres my rig so far.

IF form1.Visable = FALSE THEN
END

and it only works sometimes LOL!

please help