control array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bz

    #1

    control array

    Hi,

    I am still using vb6. The project is too big to just copy and paste it to
    VB.NET. I think I need to rewrite everything.
    One question is:

    If there is no control array, is it better to just create the bunch of
    button objects from one button control rather than just drag and drop a
    bunch of buttons on the screen?



  • RobinS

    #2
    Re: control array

    It doesn't matter. The only benefit to creating one button
    control and copying and pasting it multiple times is that
    all of them will be the same size. But you can get the same
    thing by selecting all of them and using the menu options
    to make them the same size.

    The question is why are they in a control array; what are you
    doing with them?

    You can add them to a generic list and access them that way,
    or you can cycle through all the controls looking for them,
    and identify them by the fact that they are buttons, or by
    the value you place in the Tag field. If you need to know how
    to do that, re-post and I (or someone else) will post the
    code for that.

    Good luck.
    Robin S.
    --------------------------------------
    "bz" <nospam@yahoo.c omwrote in message
    news:Own5X1wHHH A.3952@TK2MSFTN GP02.phx.gbl...
    Hi,
    >
    I am still using vb6. The project is too big to just copy and paste
    it to VB.NET. I think I need to rewrite everything.
    One question is:
    >
    If there is no control array, is it better to just create the bunch of
    button objects from one button control rather than just drag and drop
    a bunch of buttons on the screen?
    >
    >
    >

    Comment

    • Martin Milan

      #3
      Re: control array

      "RobinS" <RobinS@NoSpam. yah.nonewrote in
      news:3MydnR7nhO UPCR3YnZ2dnUVZ_ tadnZ2d@comcast .com:
      It doesn't matter. The only benefit to creating one button
      control and copying and pasting it multiple times is that
      all of them will be the same size. But you can get the same
      thing by selecting all of them and using the menu options
      to make them the same size.
      >
      The question is why are they in a control array; what are you
      doing with them?
      >
      You can add them to a generic list and access them that way,
      or you can cycle through all the controls looking for them,
      and identify them by the fact that they are buttons, or by
      the value you place in the Tag field. If you need to know how
      to do that, re-post and I (or someone else) will post the
      code for that.
      >
      Good luck.
      Robin S.
      Hi again Robin,

      I was under the impression that dotnet controls didn't have tag
      properties...

      Martin

      Comment

      • rowe_newsgroups

        #4
        Re: control array

        I was under the impression that dotnet controls didn't have tag
        properties...
        At least in the .Net 2.0 controls have the tag property. If they don't
        then the project I used them in today is in bad shape :-)

        Thanks,

        Seth Rowe


        Martin Milan wrote:
        "RobinS" <RobinS@NoSpam. yah.nonewrote in
        news:3MydnR7nhO UPCR3YnZ2dnUVZ_ tadnZ2d@comcast .com:
        >
        It doesn't matter. The only benefit to creating one button
        control and copying and pasting it multiple times is that
        all of them will be the same size. But you can get the same
        thing by selecting all of them and using the menu options
        to make them the same size.

        The question is why are they in a control array; what are you
        doing with them?

        You can add them to a generic list and access them that way,
        or you can cycle through all the controls looking for them,
        and identify them by the fact that they are buttons, or by
        the value you place in the Tag field. If you need to know how
        to do that, re-post and I (or someone else) will post the
        code for that.

        Good luck.
        Robin S.
        >
        Hi again Robin,
        >
        I was under the impression that dotnet controls didn't have tag
        properties...
        >
        Martin

        Comment

        • RobinS

          #5
          Re: control array


          "Martin Milan" <I8sp@m.i.dowro te in message
          news:Xns989AF86 46566I8spmido@1 94.117.143.38.. .
          "RobinS" <RobinS@NoSpam. yah.nonewrote in
          news:3MydnR7nhO UPCR3YnZ2dnUVZ_ tadnZ2d@comcast .com:
          >
          >It doesn't matter. The only benefit to creating one button
          >control and copying and pasting it multiple times is that
          >all of them will be the same size. But you can get the same
          >thing by selecting all of them and using the menu options
          >to make them the same size.
          >>
          >The question is why are they in a control array; what are you
          >doing with them?
          >>
          >You can add them to a generic list and access them that way,
          >or you can cycle through all the controls looking for them,
          >and identify them by the fact that they are buttons, or by
          >the value you place in the Tag field. If you need to know how
          >to do that, re-post and I (or someone else) will post the
          >code for that.
          >>
          >Good luck.
          >Robin S.
          >
          Hi again Robin,
          >
          I was under the impression that dotnet controls didn't have tag
          properties...
          >
          Martin
          As noted by Seth, they *do* have the property [Tag]. And
          thank goodness they didn't get rid of *that*!

          Robin S.


          Comment

          • Martin Milan

            #6
            Re: control array

            "RobinS" <RobinS@NoSpam. yah.nonewrote in
            news:BKGdne5A9e i-pR_YnZ2dnUVZ_h6 3nZ2d@comcast.c om:
            As noted by Seth, they *do* have the property [Tag]. And
            thank goodness they didn't get rid of *that*!
            >
            Robin S.
            Was it supported in 1.0 and 1.1?

            The reason I thought it had gone is that once again I've been reading a
            VB6 to dotnet conversion text (and old one though) which said they had
            gone. Our VB6 project makes plenty of use of tag as well...

            Martin

            Comment

            • Stephany Young

              #7
              Re: control array

              Yes. Tag has been a property of the System.Windows. Forms.Control since .NET
              Framework 1.0.

              This means that any class derived from System.Windows. Forms.Control
              automatically has it.

              However, a class derived from System.Windows. Forms.Control may override the
              Tag property of the base class and implement it in a different way, e.g.:

              Public Overrides Property Tag() As Object
              Get
              Throw New Exception("Not implemented.")
              End Get
              Set(value As Object)
              Throw New Exception("Not implemented.")
              End Set
              End Property

              Why anyone would want to do so escapes me, but it is possible.

              There are a multitude of classes on the Framework that, of course, are not
              derived from System.Windows. Forms.Control, and any of those may or may not
              expose a Tag property depending on who wrote the class, how they were
              feeling at the time and whether or not the month had a 'y' in it, etc.


              "Martin Milan" <I8sp@m.i.dowro te in message
              news:Xns989A510 B12E0EI8spmido@ 194.117.143.37. ..
              "RobinS" <RobinS@NoSpam. yah.nonewrote in
              news:BKGdne5A9e i-pR_YnZ2dnUVZ_h6 3nZ2d@comcast.c om:
              >
              >As noted by Seth, they *do* have the property [Tag]. And
              >thank goodness they didn't get rid of *that*!
              >>
              >Robin S.
              >
              Was it supported in 1.0 and 1.1?
              >
              The reason I thought it had gone is that once again I've been reading a
              VB6 to dotnet conversion text (and old one though) which said they had
              gone. Our VB6 project makes plenty of use of tag as well...
              >
              Martin

              Comment

              Working...