It is always awful when you end up with sick fish and in some cases, no matter what you do, you never seem to be able to prevent it which can be frustrating as well.
Ensuring that you keep your fish clean and stick to a routine of when you clean will help to prevent your fish from getting sick.
Not overfeeding your fish and also not under feeding will also prevent them from getting sick as well.