Groups | Blog | Home
all groups > dotnet windows forms databinding > february 2006 >

dotnet windows forms databinding : MySettings as a data source


Tim Ferguson
2/23/2006 10:20:21 AM
I know I am missing something conceptual here, probably pretty simple too.

I am trying to make a user preferences dialog box.

I have a Windows form with suitable textboxes on. In VB 2005 Express, I
created a datasource from the My.Settings object, and dragged the "fields"
from that datasource onto the textboxes. A bindingsource object appeared in
the tray, and the properties of the textboxes show the correct links in the
Bindings properties. So far so good.

On loading the form, however, I get a bunch of empty textboxes instead of
the values that are actually in the settings.

I can't see any code anywhere to make the bindingsource actually go and get
the data from the My.Settings object itself, nor how to make it send the
altered values back. I don't know whether I need a data.datatable
somewhere, but I'm not quite sure how to create it; or if it's just a
MySettingsBindingSource.Bindings.Refresh (no, that doesn't seem to do
anything).

Thanks in advance

Tim F
Jim Hughes
2/23/2006 2:25:35 PM
search MSDN help for "ChangeAndPersistSettings" or "How to: Persist User
Settings in Visual Basic"

and "How to: Create Property Grids for User Settings in Visual Basic" you
don't even need the textboxes!

"ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vbcn/html/0e5e6415-b6e2-4602-9be0-a65fa167d007.htm"


[quoted text, click to view]

Tim Ferguson
2/24/2006 9:30:40 AM
"Jim Hughes" <NOSPAMJ3033@Hotmail.com> wrote in
news:emooRgMOGHA.532@TK2MSFTNGP15.phx.gbl:

[quoted text, click to view]
Thank you Jim. The property grid is a very cool solution.

Actually, with a bit more experimentation, I found a way. Calling

MySettingsBindingSource.AddNew

gets the data out of the oject and into the textboxes, although I really
don't understand why.

Thanks for your help


Tim F


AddThis Social Bookmark Button