|I haven't done a c# project in some time, and trying to remember all the things I've forgotten.
I have an application with various application & user settings. I want the user to be able to set those preferences. I figured out how to use a property grid to show settings on the appropriate form:
Properties.Settings mySettings = new Properties.Settings();
private void SettingsForm_Load(object sender, EventArgs e)
this.propertyGrid1.SelectedObject = mySettings;
It seems I can't bind the Settings directly to the property grid, I had to create an object from the settings and bind to that. I put the object assignment at form level in case I needed it to update later, but it could also be assigned in the form load event if I don't need to refer to it later.
This shows application settings as disabled and user settings enabled in the property grid, as expected.
Now I want to change a setting and save that back to the actual settings file. I can't seem to find any recent article on how to do that. I found an article from 2009 but it was quite complex, and I feel like that should be simpler in .Net 5.
Did I properly load the property grid?
Is there a way to update all changed user settings in 1 go, or do I need to iterate each property grid item, verify if it was changed, then update the actual setting?
How do I iterate the grid items, skipping categories & disabled items, and put them back into the settings?
Thanks so much for any help....