No Forms Collection

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

Does anybody know why VB.NET would omit the Forms collection available in
previous versions versions of VB? I imagine that there must be a reason why
they decided to do away with it, but I can't fathom why. Does anybody know?
 
Alex,
Does anybody know why VB.NET would omit the Forms collection available in
previous versions versions of VB? I imagine that there must be a reason
why
they decided to do away with it, but I can't fathom why. Does anybody
know?
Is this not a question from 2002 and almost forever answered?

In VBCom there is no collection from other controls. Now we can use for
every control a collection where the base clase Control is used that holds a
collection for that.

When you want you can create now as much collections of controls collections
shaped for your own need as you want.

Cor
 
Cor,

Cor Ligthert said:
In VBCom there is no collection from other controls. Now we can use for
every control a collection where the base clase Control is used that holds
a collection for that.

When you want you can create now as much collections of controls
collections shaped for your own need as you want.

.... which is a step backwards. VB6's forms collection was self-maintaining,
so you didn't need to add/remove forms from it.
 
... which is a step backwards. VB6's forms collection was
self-maintaining, so you didn't need to add/remove forms from it.

I assume that you mean in your opinion. In my opinion it is a small
step..........................

:-)

Cor
 
Cor Ligthert said:
I assume that you mean in your opinion. In my opinion it is a small
step..........................

How do you go about finding out if an instance of a particular form class
already exists?
 
Cor Ligthert said:
Is this not a question from 2002 and almost forever answered?

I don't know if this is a question from 2002 or not as I wasn't doing .net
development in 2002. I did do a Usenet and an MSDN search before posting my
question and I found several posts or articles dealing with this as a fact -
and with workarounds for this issue - but I found none that delved into why.
After the several helpful replies to my initial post, I still don't know, and I
still wonder why MS decided to do this. I can't imagine that it was an
omission.
 
Alex said:
I don't know if this is a question from 2002 or not as I wasn't doing .net
development in 2002. I did do a Usenet and an MSDN search before posting my
question and I found several posts or articles dealing with this as a fact -
and with workarounds for this issue - but I found none that delved into why.
After the several helpful replies to my initial post, I still don't know, and I
still wonder why MS decided to do this. I can't imagine that it was an
omission.

While I am not privy to MS internal decisionmaking, I can see that one
problem might be this:

In VB6 Forms is a collection of all 'loaded' forms. In Vb.Net I am not
sure there is really any such thing as a 'loaded' form. There are those
Form objects which are currently referenced; visible forms; but no real
in-between state that corresponds to a VB6 'Load'ed but not visible.

OK maybe you could have a collection of all Form objects that are
currently referenced - but unless you used WeakReferences (which I only
found out about the other day), this would stop forms ever being GC'd.

I don't think it's *too* onerous to require developers to keep track of
the objects they create. Personally I think the only times I ever
actually used the Forms collection were when I had lost track of a form
and found myself at a point where I thought I had exited everything but
still was in run-mode. I used to have a debug routine at the end of my
main execution path that Debug.Print'd everything in Forms - that way I
could try and trace what I had forgotten.

I would of course welcome examples of where Forms is geniunely useful
:)
 
Cor,

Cor Ligthert said:
I assume that you mean in your opinion. In my opinion it is a small
step..........................

The main difference is that VB6 provided a "standardized" way to keep track
of form instances in the 'Forms' collection, which made exchanging forms
between projects much easier. In VB.NET, currently people have to implement
their own collection which leads to many different, non-compatible
solutions.
 
Larry said:
I would of course welcome examples of where Forms is geniunely useful
:)

I used to use the Forms collection for quite a few things.

A couple of examples:

I'd use it to determine whether a form in my application was already being
used. If the user tried to open a second instance of the form then I would
just pop the existing form to the front instead of opening another instance.
That was useful.

I also used to have multiple forms open that provided different views into
an object the user was working with. When the user moved to a different
object, all of the open windows would automatically update to view the new
object instead. This was achieved by iterating through the Forms collection,
identifying forms that needed to be updated and calling a method on each to
look at the new object.

In VB.NET I can work around most of the missing functionality because I'm
writing an MDI application, so I can use the MdiChildren array. There are
occasions where I do miss it though.
 
Larry Lard said:
OK maybe you could have a collection of all Form objects that are
currently referenced - but unless you used WeakReferences (which I only
found out about the other day), this would stop forms ever being GC'd.

If the Form object is being currently referenced then you wouldn't want it to
be GC'd.
 
Herfried,
The main difference is that VB6 provided a "standardized" way to keep
track of form instances in the 'Forms' collection, which made exchanging
forms between projects much easier. In VB.NET, currently people have to
implement their own collection which leads to many different,
non-compatible solutions.

This discussion in this thread looks for me about religion, you tell that
everybody needs it. And I don't need it, in those situations it has no
sense to discuss, you believe it or not.

I was more interesting in a reply on the message where you wrote about that
byte collection. I took some time to make if visible what you wrote.

Cor
 
Cor,

Cor Ligthert said:
This discussion in this thread looks for me about religion, you tell that
everybody needs it. And I don't need it, in those situations it has no
sense to discuss, you believe it or not.

Huh? Where did I write that everybody needs a 'Forms' collection?! The
whole discussion is absolutely not about "religion".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top