Load & Save Controls

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Henry Wu

    Load & Save Controls

    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,..howeve r, 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
  • One Handed Man \( OHM - Terry Burns \)

    #2
    Re: Load & Save Controls

    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

    "Henry Wu" <henrycortezwu@ hotmail.com> wrote in message
    news:8612270.04 09150717.14fb1a e9@posting.goog le.com...[color=blue]
    > 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,..howeve r, 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[/color]


    Comment

    • Henry C. Wu

      #3
      Re: Load &amp; Save Controls

      > 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

      Comment

      • One Handed Man \( OHM - Terry Burns \)

        #4
        Re: Load &amp; Save Controls

        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

        "Henry C. Wu" <henrycortezwu@ gmail.com> wrote in message
        news:44f096ca.0 409172144.269e6 7f3@posting.goo gle.com...[color=blue][color=green]
        > > Are the number of controls likley to differ between saves ?[/color]
        >
        > 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[/color]


        Comment

        • Henry Wu

          #5
          Re: Load &amp; Save Controls

          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,valu es,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_v ariable = text_file ,
          then loop through the control array variable to display the saved
          controls again.

          Thanks,
          Henry

          Comment

          • Cor Ligthert

            #6
            Re: Load &amp; Save Controls

            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


            Comment

            Working...