When Frederick II died in 1786 , his nephew Frederick William II succeeded him , and Charlottenburg became the favourite royal residence , and remained so for his son and successor Frederick William III ( reigned 1797-1840 ) .
When Frederick II died in 1786 , his nephew Frederick William II succeeded him , and Charlottenburg became his favourite residence , as it was for his son and successor Frederick William III .