Search code examples
vb.netdata-bindingmy.settings

My.settings is not available for a new form, and previous bindings to My.Settings on other forms cannot be altered (grayed out)


VB and VS 2019 - I have a forms application and have used My.Settings successfully to bind textboxes to settings. It worked as it should. I recently added a new form and My.Settings is not listed for data binding (instead I get "add project datasource"). Additionally, my previous bindings of textboxes to My.Settings cannot be edited as the DataBndings "text" line is grayed out. It does display the previous binding as "(MySettings) - Matl2_Name". I added my new settings to My.Settings. Dragging and dropping a setting onto a textbox results in "MySettingsBindingSource - PR1Name" and it doesn't save.

Any help is appreciated.


Solution

  • Here's a step by step, do you get the same result?

    • A new form:

    enter image description here

    • A textbox on it:

    enter image description here

    • Properties for it - going to bind the Text to a new setting (under the (Application Settings) grid node, NOT the (Data Bindings) node)

    enter image description here

    • Settings binder:

    enter image description here

    • Values:

    enter image description here

    • All done - bound to setting now (and of course you cannot also bind the same property to a data providing thing, so it's greyed out - but you're binding settings, not data)

    enter image description here

    • And the control has the value in the settings:

    enter image description here enter image description here