Samsung Galaxy Ace S5800 Hard Reset
Reset Via Settings
Switch on the device.
On the Settings screen, touch Privacy > Factory data reset.
When prompted, touch Reset phone, and then touch Erase everything. Device resets the settings to the original factory settings, and then restarts
Hard Reset
Switch off your cell phone.
Now press and hold Home button + Power button, and release them when Samsung logo appear.
Browse with volume buttons and select wipe data/factory reset with home button
Select YES and press home button
Select Reboot after format is complete
Wait until the phone restarts.
Reset Via Master key
Start by turning your device on, to do it press Power button.
Then dialling screen of your device type this code in dialer: *2767*3855#
Next on confirm whole Factory reset process by tapping Call key again.
Now your device should reboot.