-
Property Windows
Dear All,
I am trying to build Hieararchy in VB.net, but instead of creating new buttons while running the program, i've decided to create all what i need put it to invisible mode, then change it back when been used......
but i've got a problem, is that, when user specify a textname for the button, and he saved the program,,,,, then if exit vb. net and running the program again, he's lost all info he entered, he got to do everything all over again..
i got one way round it i guess, if i managed to change the properties of a button for example, what i mean by that, be able to access the window properties while running the program,, so when exiting the program and try to run it again, we wont' lose the data we've entered
thank you very much
-
-
PLEASE THAT'S QUESTIO IS REALLY IMPORTANT, I'VE GOT **** LOADS OF WORK TO DO, I AINT STARTED YET, ANYONE GOT ANY IDEAS
-
Well then you'd better get started I guess. You need to create a way to save the properties of the different controls on application exit and reload those settings on application load. You can access the properties of any control the same as any object. There is no need for the actual window that you see at DesignTime.
Button1.Visible=True
You may also want to look at 'Dynamic Properties' in the help or experiment with them on your own. You can set properties to be Dynamic via the 'DynamicProperties' part at the top of the Properties window.
-
But how can i save the properties of controls while running the program.
that's the issue :
at design time, if you specify for example,
button1.text = "design time "
but while running the program, u changed it to :
button1.text = "modified value"
so if u save the program, u exit vb .net, and u try to open the program, u always get the following,
button1.text = "design time"
and not the new value,
so please help, that's very important for me
-
DynamicProperties will do that.
Otherwise you have to make a way to save your control properties there isn't any default way.
-
As Edneeis said, you need to look into saving the data on exit and reloading it at application start. You have to do this manually but there are a variety of options. Already existing types like comma delimeted files, tab delimited, ini files, config files, databases, serialization or even your own home made format.
I would suggest looking at using .config files. They are similar to ini files and a simple way to save the data. You can also edit them by hand.