|
-
Dec 6th, 2006, 02:57 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Application Settings Bind to Variable
hi guys! help please...how can i bind the application settings to a variable..currently i have the code below which bind the value to a property of the control in that case the .Text Property of the TxtSettingsStartLocation Textbox.
Code:
private Application_Settings AppSettings = new Application_Settings();
Binding Binding_Start_Location = new Binding("Text", AppSettings, "Start_Location", true, DataSourceUpdateMode.OnPropertyChanged);
txtSettingsStartLocation.DataBindings.Add(Binding_Start_Location);
sealed class Application_Settings : ApplicationSettingsBase
{
[UserScopedSetting()]
public string Start_Location
{
get { return (string)this["Start_Location"]; }
set { this["Start_Location"] = value; }
}
}
Thanks in advance!
Last edited by daimous; Dec 6th, 2006 at 03:03 AM.
-
Dec 6th, 2006, 03:14 AM
#2
Thread Starter
Fanatic Member
Re: Application Settings Bind to Variable
Oh! i got it...this is what I did..
Code:
String CurrentLocation;
string NewStartLocation = "My new location"
CurrentLocation = AppSettings.Start_Location;
AppSettings.Start_Location = NewStartLocation
anyway....any good suggestion than that?
-
Dec 6th, 2006, 03:27 AM
#3
Re: Application Settings Bind to Variable
There's no such thing as binding to a variable. The data-binding mechanism requires the use of properties. You can simply assign a value from a setting to a variable and back again, but the .NET data-binding mechanism requires a property. That's because properties are actually methods internally and thus can do much more than a simple assignment, which is all you can do with a variable.
-
Dec 6th, 2006, 08:24 PM
#4
Thread Starter
Fanatic Member
Re: Application Settings Bind to Variable
Oh I see....Thanks for the Info JM..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|