My.User.Settings, how to bind an object when the value isn't in the Property Bindings

Relative0

Member
Joined
Sep 15, 2007
Messages
8
Programming Experience
1-3
The problem that I am struggling with is that, I can in Applications Properties -> Settings, create a bunch of User Scoped settings. Then in my application set the ApplicationSettings -> PropertyBindings to the valuse such as the "BackColor" or the "Location", but can not do something such as "Sound". So I am trying to make it so that the user can choose a sound and then the same sound is there next time the application starts. I think some of the problem is that I have one main object as a user control as instances of this main user control, (call it the "Box"). So I have one main "Box" in a user control and a bunch of little "boxes" on the form. I want to be able to do save a user setting for each of the individual boxes so that at start up they keep the settings. The problem that I see is that the popup box on the ApplicationSettings -> PropertyBindings doesen't have something to do with Sound, (as well as all the other stuff you can choose from inside of the Properties -> Settings -> Type. How can I deal with this? I do assign a Color to each of the "boxes", which are the children of the "Box". When I start the program the colors stay the same. But again the "BackColor" option is on the popup menu so that I can bind to settings that I created inside of Settings. I, in the main "Box", have the code such as

If ColorDialog1.ShowDialog() = DialogResult.OK Then
My.Settings.Box_Color = ColorDialog1.Color
MyBase.BackColor = My.Settings.Box_Color

Now In the Settings I defined a bunch of object values such as "Box_Color" "box1_Color", "box2_Color", "box3_Color".....

Now I use the main "Box_Color" to save the ColorDialog1.Color to

My.Settings.Box_Color = ColorDialog1.Color

And I, on the ApplicationSettings -> PropertyBindings box bound each of "box1", "box2", etc... to each of "box1_Color", "box2_Color" respecively.

Now when I run the program, it works. Somehow the Color, although it is saved into the Generic "Box_Color", and not to the individual "box1_Color", "box2_Color" etc. The color is saved to the "box1_Color", "box2_Color" respectively because they are bound to the specific objects. This is what I think is going on, The program somehow associates the specif color to the children. But again, since there is no "file path" or "Sound" choice on the ApplicationSettings -> PropertyBindings I don't know how to "bind them".

Any help, or even if I have to explicitly write in the app.config the values, I will learn how but am looking for some sort of easier way, (perhaps to just be able to add values to the ApplicationSettings -> PropertyBindings box, that way I can just choose and use them.

Thanks much,

Brian
 
when you say "Sound" are you hoping that e.g. the Settings can contain a WAV file that will play every time the mouse passes over the box, or something?

Um.. I dont think it's designed to be *that* sophisticated. By all means though, bind the .Tag to the string filepath of a WAV file and when the mouse passes over, get the tag, cast it to string, and play the sound denoted by the file.. If its a resource, well, store the name of it, or something..

I never saw a .Sound property on a text box.. ?
 
Back
Top