How do I delete all the files on my computer? (Like formating PC, but being able to boot windows 7 from a cd)
If I format my Local Disk C: and it deletes my files can I still boot windows 7 installation from the CD?
you cannot format the OS drive while you are running the OS. You must do this from a boot up and not enter windows. That is why you are seeing the error. Remember a format erases the entire contents of the drive and since the program you are running to format the drive is on that driver you are in effect erasing that program while its running.
What you need to do is put your OS disk into the driver and boot up from it. At the beginning will be an option to choose the partition or drive to install windows on as well as a option to format the drive. This is the point at which you need to format the drive.