Results 1 to 5 of 5

Thread: [RESOLVED] Object in run time

  1. #1

    Thread Starter
    Addicted Member o0yuna0o's Avatar
    Join Date
    Mar 2006
    Posts
    172

    Resolved [RESOLVED] Object in run time

    can i create an object in run time for example label object

    by the way... has anyone know some vb tutorial site regarding data report... thanks in advance

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,425

    Re: Object in run time

    Will that 'new' Lable be part of an existing Control arry (of Labels)?
    Handy References:
    MSDN Library
    ADO Tutorial Excel Tutorial MZTools (VB6)

    • Please pull down the Thread Tools menu and click the 'Mark Thread Resolved' button, or alternately edit your original post and add "Resolved" or place a in the subject when your question(s) have been answered.
    • Please use code tags [highlight=vb] your code goes here between the tags [/highlight] when posting code.

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: Object in run time

    There are TWO ways to create control at run time:
    - control arrays
    - controls collection:
    VB Code:
    1. 'method 1: control array - add one label to your form and set Index = 0 directly in the properties window
    2. Private Sub Form_Load()
    3.     Load Label1(Label1.Ubound + 1)
    4.     Label1(Label1.Ubound).Move 300, 300 'change these numbers to position new label where you need to
    5.     Label1(Label1.Ubound).Caption = "New Label Control"
    6.     Label1(Label1.Ubound).Visible = True
    7. End Sub
    8.  
    9. 'method 2: controls collection
    10. Private Sub Form_Load()
    11. Dim lbl As Label
    12.  
    13.     Set lbl = Me.Controls.Add("VB.Label", "lblTemp"
    14.     lbl.Move 300, 300 'change these numbers to position new label where you need to
    15.     lbl.Caption = "New Label Control"
    16.     lblVisible = True
    17. End Sub

  4. #4

    Thread Starter
    Addicted Member o0yuna0o's Avatar
    Join Date
    Mar 2006
    Posts
    172

    Re: Object in run time

    tnx rhino...

  5. #5

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