Load & Save Controls

  • Thread starter Thread starter Henry Wu
  • Start date Start date
H

Henry Wu

Hi, I was wondering if I could save all of the controls in a
tabcontrol for example, complete with the controls' name, text, value,
position, size, etc..

Then when the user opens the application again, and hits the Load
Button, it would load all the controls to the tabcontrol intact, this
is done via code of course.

How do I go about this? Looping all controls in the tabcontrol and
saving all of its information in a text file? xml file? Then when
loading just do a lot of "If" statements searching for keywords at the
saved text or xml file??

I guess that would be doable,..however, is there a "standard" way for
this? Or better yet an example that I could get a good look at on how
to go around this problem? Or the solution is easy and no example is
required?

Thanks again,
Henry
 
Are the number of controls likley to differ between saves ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
Are the number of controls likley to differ between saves ?

Yes, the number of controls will differ, because there are buttons
that would add extra tabpages, which in each tabpage has a set of
controls.

Do you have something in mind that may be able to help me out?

Thanks,
Henry
 
Well, I think you have the basic idea anyway. All controls have the Size and
Location properties so you could do something like this. And do something
similar on Form_Load in reverse

Dim tab as Control
Dim innerC as Control
For Each c as Control in Me.Controls

if TypeOf c Is TabPage Then

'Sace c.Size
'Save c.Location

For Each innerC in c.Controls

'Save innerC.Size
'Save innerC.Location
'Save innerC.Name

Next


End If

Next









--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
Hi,..im just thinking out of the box here,..is there a way that I
could do the following
1. Loop through all the controls i would like to save
2. Save all the properties,values,txt,etc of the controls in a control
array variable
3. Save the control array variable at a text file
4. Then when needed, one can do a control_array_variable = text_file ,
then loop through the control array variable to display the saved
controls again.

Thanks,
Henry
 
Henry,

In addition to OHM, there are two posibilities, serialize the controls or
saving the properties, where I would as OHM showed would go for just saving
the properties in a routine as he showed.

My expirience is that the on disk written dataset is the best place to save
these settings when they are as many as you describe. When it would only be
the form height and place, I would go for the registry.

I hope this addition helps as well?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top