Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / February 2006

Tip: Looking for answers? Try searching our database.

MySettings as a data source

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim Ferguson - 23 Feb 2006 18:20 GMT
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 - 23 Feb 2006 22:25 GMT
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"

>I know I am missing something conceptual here, probably pretty simple too.
>
[quoted text clipped - 22 lines]
>
> Tim F
Tim Ferguson - 24 Feb 2006 17:30 GMT
> 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!

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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.