Results 1 to 3 of 3

Thread: [resolved] Dyanmic Control Array - positioning new elements

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Albany, NY
    Posts
    489

    [resolved] Dyanmic Control Array - positioning new elements

    The code works for the first new element of Cards() but not
    for the second or third. It seems to create new elements and
    place them on top of one another. I'm not sure why it would
    do this.......

    All I want if for the new Card(x) to be 200 twips to the left
    of the previous card. Any suggestions are appreciated.

    VB Code:
    1. Private Sub CreateNewcard()
    2.  
    3.     Load Cards(Cards.UBound + 1)
    4.     MsgBox Cards.UBound
    5.  
    6.     With Cards(Cards.UBound)
    7.         .Container = Cards(Cards.UBound - 1).Container
    8.         .Top = Cards(Cards.UBound - 1).Top
    9.         .Left = Cards(Cards.UBound - 1) + Cards(Cards.UBound - 1).Width + 200
    10.         .Height = Cards(Cards.UBound - 1).Height
    11.         .Width = Cards(Cards.UBound - 1).Width
    12.         .BackStyle = Cards(Cards.UBound - 1).BackStyle
    13.         .BackColor = Cards(Cards.UBound - 1).BackColor
    14.         .Shape = Cards(Cards.UBound - 1).Shape
    15.         .Visible = True
    16.     End With
    17.  
    18. End Sub
    Last edited by jcfowl; Aug 26th, 2003 at 08:59 AM.

  2. #2
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    reexamine this statement

    .Left = Cards(Cards.UBound - 1) + Cards(Cards.UBound - 1).Width + 200

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Albany, NY
    Posts
    489
    Thanks, I appreciate it.
    I'm supprised I didn't get an error.

    VB Code:
    1. Private Sub CreateNewcard()
    2.  
    3.     Load Cards(Cards.UBound + 1)
    4.  
    5.     With Cards(Cards.UBound)
    6.         .Container = Cards(Cards.UBound - 1).Container
    7.         .Top = Cards(Cards.UBound - 1).Top
    8.         .Left = Cards(Cards.UBound - 1).Left + Cards(Cards.UBound - 1).Width + 200
    9.         .Height = Cards(Cards.UBound - 1).Height
    10.         .Width = Cards(Cards.UBound - 1).Width
    11.         .BackStyle = Cards(Cards.UBound - 1).BackStyle
    12.         .BackColor = Cards(Cards.UBound - 1).BackColor
    13.         .Shape = Cards(Cards.UBound - 1).Shape
    14.         .Visible = True
    15.     End With
    16.  
    17. End Sub

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