Results 1 to 2 of 2

Thread: Adding Controls to the Form (w/o designer)

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    1

    Adding Controls to the Form (w/o designer)

    I'm trying to code a button that puts a new label on the form.

    I have tried:
    VB Code:
    1. Dim lblNew As New Label
    2.         lblNew.Name = "lblNew"
    3.         lblNew.Text = "Text"
    4.  
    5.         Me.Controls.Add(lblNew)

    What is the right way to do this?

  2. #2
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Adding Controls to the Form (w/o designer)

    try changing the Top and Left properties so the label is somewhere in the middle of the form and you'll see it

    other than that, that's how ya add controls to a form without the designer
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

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