So in my program I have a settings page. On the settings page, there is an option to set the program “Always on Top”. When this option is checked and unchecked, it properly saves the setting, but it does not actually change TopMost property itself.
The program’s main form is called “MainForm”, but the settings page is called “SettingsForm”. How would I change the “TopMost” property on “MainForm”, from within the “SettingsForm”?
One approach would be to simply give
SettingForma reference toMainForm, e.g. via a constructor parameter which is then stored to a field where it can later be accessed when necessary.For example:
(However, it may not be necessary to do this if the owner of
SettingsFormis already the insntance ofMainFormbut this I cannot tell from what you have given.)