PC Review


Reply
Thread Tools Rate Thread

Data binding to My.Settings

 
 
Bob Altman
Guest
Posts: n/a
 
      3rd Aug 2006
How do I bind a value from My.Settings to a property on a control on a
Windows form?

I've created a setting called My.Settings.Value1 of type String. Now I want
to create a "Settings" dialog box that allows the user to view or change
My.Settings.Value1.

I added My.MySettings as a Data Source.
I created a simple dialog box with Ok and Cancel buttons.
I dragged Value1 from the Data Sources window to the form. The designer
dutifully created a TextBox with its Text property wired to a BindingSource,
plus a BindingNavigator (the purpose of which is a mystery to me).

I run my application, display the dialog box, type something into the
TextBox, and click the Ok button. In the Ok button's Click event handler,
My.Settings.Value1 contains an empty string. (Yes I called
MySettingsBindingSource.EndEdit before I examined the value of
My.Settings.Value1.)

Any suggestions? TIA!

- Bob


 
Reply With Quote
 
 
 
 
Bob Altman
Guest
Posts: n/a
 
      3rd Aug 2006
I stumbled across the answer in the latest issue of CoDe Magazine
(http://www.code-magazine.com/Article...uickid=0607031). Simply select
the control, and, in the properties window open the (Application Settings)
property. Then click on the [...] button in the (Property Bindings)
property.

Apparently, trying to use the Data Source magic to create a binding doesn't
work. Looks like a bug to me...

- Bob

"Bob Altman" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> How do I bind a value from My.Settings to a property on a control on a
> Windows form?
>
> I've created a setting called My.Settings.Value1 of type String. Now I
> want
> to create a "Settings" dialog box that allows the user to view or change
> My.Settings.Value1.
>
> I added My.MySettings as a Data Source.
> I created a simple dialog box with Ok and Cancel buttons.
> I dragged Value1 from the Data Sources window to the form. The designer
> dutifully created a TextBox with its Text property wired to a
> BindingSource,
> plus a BindingNavigator (the purpose of which is a mystery to me).
>
> I run my application, display the dialog box, type something into the
> TextBox, and click the Ok button. In the Ok button's Click event handler,
> My.Settings.Value1 contains an empty string. (Yes I called
> MySettingsBindingSource.EndEdit before I examined the value of
> My.Settings.Value1.)
>
> Any suggestions? TIA!
>
> - Bob
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
100K item data binding: Is asynchronous data binding possible? R Reyes Microsoft C# .NET 14 5th Feb 2008 10:47 PM
Late Binding examples of binding excel application =?Utf-8?B?SGVhdGhlck8=?= Microsoft Excel Programming 14 17th Mar 2005 09:19 AM
threading, what different between DataGrid Binding to Binding TextBox mttc Microsoft Dot NET Framework Forms 3 19th Nov 2004 09:33 AM
Re: Data Binding - using inline code vs. functions vs. straight binding Alvin Bruney [MVP] Microsoft ASP .NET 0 9th Mar 2004 02:24 PM
EARLY binding or LATE binding ? jason Microsoft Excel Programming 6 26th Feb 2004 05:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:13 PM.