Home All Groups Group Topic Archive Search About
Author
13 Dec 2006 11:14 PM
bz
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?

Author
14 Dec 2006 12:02 AM
RobinS
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.
--------------------------------------
Show quoteHide quote
"bz" <nospam@yahoo.com> wrote in message
news:Own5X1wHHHA.3952@TK2MSFTNGP02.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?
>
>
>
Author
15 Dec 2006 1:31 AM
Martin Milan
Show quote Hide quote
"RobinS" <RobinS@NoSpam.yah.none> wrote in
news:3MydnR7nhOUPCR3YnZ2dnUVZ_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
Author
15 Dec 2006 1:40 AM
rowe_newsgroups
> 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:
Show quoteHide quote
> "RobinS" <RobinS@NoSpam.yah.none> wrote in
> news:3MydnR7nhOUPCR3YnZ2dnUVZ_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
Author
15 Dec 2006 5:52 AM
RobinS
Show quote Hide quote
"Martin Milan" <I***@m.i.do> wrote in message
news:Xns989AF8646566I8spmido@194.117.143.38...
> "RobinS" <RobinS@NoSpam.yah.none> wrote in
> news:3MydnR7nhOUPCR3YnZ2dnUVZ_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.
Author
15 Dec 2006 7:57 AM
Martin Milan
"RobinS" <RobinS@NoSpam.yah.none> wrote in
news:BKGdne5A9ei-pR_YnZ2dnUVZ_h63nZ2d@comcast.com:

> 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
Author
15 Dec 2006 9:21 AM
Stephany Young
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.


Show quoteHide quote
"Martin Milan" <I***@m.i.do> wrote in message
news:Xns989A510B12E0EI8spmido@194.117.143.37...
> "RobinS" <RobinS@NoSpam.yah.none> wrote in
> news:BKGdne5A9ei-pR_YnZ2dnUVZ_h63nZ2d@comcast.com:
>
>> 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