CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Location
    canada
    Posts
    124

    New control in the code

    How can I create a new control (like a TextBox)
    in the code???
    Is it possible???
    Help me please...

    Isabelle


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: New control in the code

    If you have VB6, you can add control directly to the Controls Collection, eg.

    private Sub Command1_Click()
    Controls.Add "VB.Textbox", "Text1"
    me!Text1.Move 0, 0
    me!Text1.Text = Text1
    me!Text1.Visible = true
    End Sub



    Otherwise, you could create a Control Array of Invisible Textboxes at DesignTime, (Create1 and Set the Index to Zero), then load the Textboxes as you need them, eg.

    private Sub Command1_Click()
    Load Text1(1)
    Text1(1).Move 0, 0
    Text1(1).Caption = Text1
    Text1(1).Visible = true
    End Sub





    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Jan 2000
    Location
    canada
    Posts
    124

    Re: New control in the code

    And for a Control Array???


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