CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Posts
    2

    Creating controls dynamicaly

    How to create controls dynamicaly, and latter to use them trough array.

    Please email answer to [email protected]

    Thanks


  2. #2
    Join Date
    Oct 1999
    Location
    NV, USA
    Posts
    4

    Re: Creating controls dynamicaly

    Hi,
    Have the desired control with index 0. To load controls dynamically call "LOAD" control function with a new index. For example,
    lets say we have a Textbox control txtCntrl indexed 0 at design time.
    At run time u say
    ..........
    ........
    Load txtCntrl(1)
    .......
    ...........
    in the similar way u unload the controls.
    Does that answer u'r question


  3. #3
    Guest

    Re: Creating controls dynamicaly

    VB 6 also allows to add controls dynamically at run time without need to have an array. The example of adding Text Box:

    private Sub Form_Load()
    Form1.Controls.Add "VB.TextBox", "txtMyText"
    With Form1!txtMyText ' you can also use next sintax
    'With Form1.Controls("txtMyText")
    .Visible = true
    .Top = 500
    .Left = 1000
    .Width = 2000
    .Height = 315
    .Text = "It Works!"
    End With
    End Sub



    Just paste this code into empty form and run.
    HTH
    Vlad


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

Featured