from Windows Form how do i create a LABEL in code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coldude
    New Member
    • Apr 2007
    • 9

    #1

    from Windows Form how do i create a LABEL in code

    hi there,

    I need to be able to generate multiple labels for the use in a Windows form, the quantity of labels would depend on a count, is it possible to generate multiple labels in code? If so how do I define and declare a label?

    Could just make a pile of blank labels and set them to invisible ready at my disposal, but I thought surly there must be an easier way in code.

    I am working on a project that I need to vary the quantity, size and text of labels, simular to an Event Calendar.


    i hope you can help me


    Colin
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Believe it or not, this is easier in VB6 than in later versions, since Microsoft in their infinite wisdom decided to remove control arrays after version 6.

    (Note, this is my opinion only. I'm a VB6 user. So although I know that control arrays have been removed in VB.Net, it's quite possible there are better ways to achieve the same results.)


    In any case, to start we'll need to know what version of VB you are using.

    Comment

    • coldude
      New Member
      • Apr 2007
      • 9

      #3
      ohh, ok.. im using Visual Basic.Net 2003, Version 7.


      i hope this helps you

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by coldude
        ohh, ok.. im using Visual Basic.Net 2003, Version 7.
        i hope this helps you
        Well, I don't know VB.Net myself. I've just done a search on key terms "vb create control runtime" at TheScripts, and come up with a ton of links. Here are the first few, but you can just do a bit of searching. It appears that this subject has been covered numerous times.
        Create button control at runtime
        creating controls at runtime
        Create control at runtime with process
        How to Create Object at Runtime

        Comment

        • iburyak
          Recognized Expert Top Contributor
          • Nov 2006
          • 1016

          #5
          Originally posted by coldude
          hi there,

          I need to be able to generate multiple labels for the use in a Windows form, the quantity of labels would depend on a count, is it possible to generate multiple labels in code? If so how do I define and declare a label?

          Could just make a pile of blank labels and set them to invisible ready at my disposal, but I thought surly there must be an easier way in code.

          I am working on a project that I need to vary the quantity, size and text of labels, simular to an Event Calendar.


          i hope you can help me


          Colin
          See this discussion it is about a button generation at run time but could be a label which is even easier doesn’t need any events.



          Hope it helps.
          Good Luck.
          Last edited by Killer42; Apr 11 '07, 06:16 AM. Reason: Activate link

          Comment

          • coldude
            New Member
            • Apr 2007
            • 9

            #6
            thanks for that, i guess my biggest trouble was that i didnt know the correct term for what i was trying to create.. the Control Array, now i wont forget it..




            thanks again


            Colin

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by coldude
              thanks for that, i guess my biggest trouble was that i didnt know the correct term for what i was trying to create.. the Control Array, now i wont forget it..
              Let us know how it turns out. :)

              Comment

              Working...