Results 1 to 4 of 4

Thread: A Label on Frames in Array

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2009
    Location
    vbforums
    Posts
    809

    A Label on Frames in Array

    I need help how to put a label on all the frames in array ... one label visible on all the frames in array.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: A Label on Frames in Array

    Suggestions. For dynamically loading the labels in runtime

    1. Place a label on the 1st frame in your array. Make its index = 0. I'll call it lblDefault
    2. For each frame you want to add a label to
    Code:
    Load lblDefault(lblDefault.UBound + 1)
       With lblDefault(lblDefault.UBound)
          Set .Container = FrameX(whateverIndex)
          .Move newX, newY
          .Visible = True
          .Enabled = True
          .Caption = newCaption ' only if needed else caption will be same as lblDefault(0)
          ' any additional properties you want set?
    End With
    lblDefault(0) doesn't have to be in your first frame, it can be anywhere on the form, hidden or not.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2009
    Location
    vbforums
    Posts
    809

    Re: A Label on Frames in Array

    my question is bit different i do not want to have any index=0 for label .. i have almost 100 frames in array and i want put a label on frame1(100) which is last frame index. if i call frame1(0) the label should remain there.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: A Label on Frames in Array

    Using an array of labels should make coding easier. But you can add a label without an index also which requires you to create unique names for the labels...
    Code:
     ' Index is the frame index, say 100 for this example
    With Me.Controls.Add("VB.Label", "lblFrame" & Index, Frame1(Index))
        .Caption = somecaption
        .Move X, Y, Width, Height
        . Enabled = True
        . Visible = True
        ' other properties
    End With
    To reference the label later in any code: Me.Controls("lblframe" & Index).ForeColor = vbBlue

    Edited: Maybe I am misunderstanding the question. Are you saying you want to move a single label around to multiple frames. In other words, 1 label shared by all your frames? If so, you will want to change containers for the label
    Code:
    Set Label1.Container = Frame1(0)
    Last edited by LaVolpe; Mar 15th, 2011 at 08:35 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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