• Create Controls at Runtime (VB.net 2002)

    Home » Forums » Developers, developers, developers » DevOps Lounge » Create Controls at Runtime (VB.net 2002)

    Author
    Topic
    #397801

    In VB 6 it was a no brainer to create new controls at runtime, how do I do this with VB.net to create an ASP.net page? confused

    Viewing 1 reply thread
    Author
    Replies
    • #755999

      After creating the controls, you have to add them to a collection (either Page, Panel, or PlaceHolder objects).

      Dim lbl as new System.Web.UI.WebControls.Label
      With lbl
      .ID = “lblTest”
      .Text = “My New Label”
      End With
      Me.Controls.Add(lbl)

      Check out a great reference (VB and C#) here: http://www.dotnetforums.net/t78075.html%5B/url%5D

      • #757553

        That worked perfectly! I dimmed the control as an array added a for/next loop and I am set.
        thankyou

      • #757554

        That worked perfectly! I dimmed the control as an array added a for/next loop and I am set.
        thankyou

    • #756000

      After creating the controls, you have to add them to a collection (either Page, Panel, or PlaceHolder objects).

      Dim lbl as new System.Web.UI.WebControls.Label
      With lbl
      .ID = “lblTest”
      .Text = “My New Label”
      End With
      Me.Controls.Add(lbl)

      Check out a great reference (VB and C#) here: http://www.dotnetforums.net/t78075.html%5B/url%5D

    Viewing 1 reply thread
    Reply To: Reply #757554 in Create Controls at Runtime (VB.net 2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel