Results 1 to 5 of 5

Thread: How to Save the control position in to structure at runtime

  1. #1

    Thread Starter
    Junior Member agpasam's Avatar
    Join Date
    Nov 2006
    Posts
    31

    How to Save the control position in to structure at runtime

    hi
    I have picture box .inside the picturebox i have so many controls is there.
    I want to store the all properties values in to structure at runtime.
    because i am using structure for undo redo opertion.

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: How to Save the control position in to structure at runtime

    You mean something like:
    VB Code:
    1. Option Explicit
    2.  
    3.     Private Type properties
    4.         left As Single
    5.         top As Single
    6.         width As Single
    7.         height As Single
    8.         '...
    9.     End Type
    10.  
    11.     Dim Label1_properties As properties
    12.  
    13. Private Sub Form_Load()
    14.     With Label1_properties
    15.         .left = Label1.left
    16.         .top = Label1.top
    17.         .width = Label1.width
    18.         .height = Label1.height
    19.         '...
    20.     End With
    21. End Sub
    ? You could declare a new type as an array and store each control's properties with a loop through controls.

  3. #3
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: How to Save the control position in to structure at runtime

    iterate through Form.Controls... check that .Container.Name for each control in form.controls is picturebox name... you can then create code to retreive relevant properties/values for each control type.

  4. #4
    New Member
    Join Date
    Nov 2006
    Posts
    1

    Re: How to Save the control position in to structure at runtime

    gavio, agpasam and leinad31 - you are all very kind!

    Thankyou for your replies. This method of saving control positions has helped me:

    i) Drag controls at runtime, on a picture box.
    ii) Save the control positions to a database.
    iii) Re-call the positions from the database, to show the controls again on the screen.

    Thanks again - and i hope to make a mini tutorial on this, to share with the world.

  5. #5
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: How to Save the control position in to structure at runtime

    you might also want to look at this thread: http://www.vbforums.com/showthread.php?t=419673

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width