Results 1 to 12 of 12

Thread: How to add additional object to form through code

Hybrid View

  1. #1

    Thread Starter
    Lively Member Brenton's Avatar
    Join Date
    Jan 2002
    Location
    Look Up!
    Posts
    125

    Re: How to add additional object to form through code

    Thanks Hack.


    But how would I reference the different label names?
    westconn1 said you cannot create a control array at runtime.

    techgnome, how would I go about doing what you suggest?

    dim arrLabel(0 to 10) as label
    dim i as integer

    for i=0 to 10
    Set arrLabel(i) = Me.Controls.Add("VB.Label", "futureLabel" & i)
    next

    for i=0 to 10
    arrLabel(i).caption="Hello" & i
    next
    The God of Death Lives Again

  2. #2
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How to add additional object to form through code

    Why not put one label at design time on the form with Index = 0, then Load the rest of the labels at run time. That way you can get the events from the control also... while if you load a label/control using Me.Controls.Add() you won't get the events from the control.

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