Discussion:
Array of Classes?
(too old to reply)
bex
2013-12-27 05:46:50 UTC
Permalink
Hey guys, how do I get this to work properly?

Public Class classOne
{
Public Shared classOneMethodOne (0 to 10) As ClassTwo
}
End Class

Public Class classTwo
{
Public Shared classTwoMethodOne(0 To 10) As Integer
Public Shared classTwoMethodTwo(0 to 10) As Integer
}
End Class

to have the declaration in the main form as

classOnePrime (0 to 10) As classOne

classOnePrime(1).classOneMethodOne(1).classTwoMethodOne(1)=7



.bex
Mayayana
2013-12-27 14:50:25 UTC
Permalink
I'm guessing that's VB.Net. Or maybe it's something
even more far afield, given the C-style syntax? (C#?)
If VB.Net has added the annoying use of superfluous
curly braces it's news to me.
In any case, this is a VB group. The basic explanation:

If you are new to VB.Net, you need to know that there
are "two VBs" in use -- VB and VB.Net -- which are entirely
different beyond their similar syntax. Likewise, there are two
kinds of VB newsgroups.

The whole situation is confusing because Microsoft dropped
".Net" from the name "VB.Net" as part of their marketing strategy
to sell .Net to VB developers.
Adding to that confusion, VB.Net has been named with several
versioning systems. There is VB.Net v. 1, 1.1, 2, 3, 4, etc. There is
VB.Net 2003, 2005, VB.Net 2008, etc. And sometimes the VB.Net
versions are referred to as VB7, VB8, VB9, etc. even though VB.Net
is not a continuation of VB6! Officially, the first set of versions
are the framework version, the second set is the IDE version,
and the 3rd set is the language version. But in practice people
mix and match the different versions and often don't distinguish
between regular VB and VB.Net

These days, VB5 and VB6 are VB. Anything else is probably VB.Net.

You need to be aware of the difference between "the two VBs"
when looking for newsgroups. The same applies when searching
for sample code. VB and VB.Net code can look very similar in
some cases, but code in one system is not applicable to the other.

The two VBs are radically different programming systems. VB is
a COM-centric system for creating compiled Windows software.
It mainly uses COM objects and the Windows API. VB.Net is
designed to be a Java competitor, similar to Java in that it is
JIT-compiled, deals almost entirely with objects, and runs on
top of a "virtual machine" -- the .Net Framework. It is optimized
for "web services" and corporate intranet programming (like Java)
rather than Windows software. VB does not use the .Net objects.
VB.Net is not directly COM compatible. The only thing in common
between the two VBs is a visual similarity in the language syntax.

Here are some .Net groups:

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.vsnet.general

They may or may not be used. Microsoft discontinued their
usenet service some time ago and disowned their groups. MS
then set up a very limited number of moderated web forums,
which require membership to use and are more a marketing
venue than a discussion group. The technical topics are
greatly reduced from the usenet groups. Nonetheless, you
might want to look into the forums if you're desperate.
--
-
"bex" <***@InDaHood.net> wrote in message news:***@4ax.com...
| Hey guys, how do I get this to work properly?
|
| Public Class classOne
| {
| Public Shared classOneMethodOne (0 to 10) As ClassTwo
| }
| End Class
|
| Public Class classTwo
| {
| Public Shared classTwoMethodOne(0 To 10) As Integer
| Public Shared classTwoMethodTwo(0 to 10) As Integer
| }
| End Class
|
| to have the declaration in the main form as
|
| classOnePrime (0 to 10) As classOne
|
| classOnePrime(1).classOneMethodOne(1).classTwoMethodOne(1)=7
|
|
|
| .bex
Deanna Earley
2014-01-02 14:56:02 UTC
Permalink
Post by bex
Hey guys, how do I get this to work properly?
Public Class classOne
{
Public Shared classOneMethodOne (0 to 10) As ClassTwo
}
End Class
Public Class classTwo
{
Public Shared classTwoMethodOne(0 To 10) As Integer
Public Shared classTwoMethodTwo(0 to 10) As Integer
}
End Class
to have the declaration in the main form as
classOnePrime (0 to 10) As classOne
classOnePrime(1).classOneMethodOne(1).classTwoMethodOne(1)=7
I'm assuming the {} are your padding as that's not valid VB6 syntax and
I believe not VB.Net.

Also note that Shared means they're not instance specific values meaning
you can only access them via classTwo.classTwoMethodOne, instead of
instanceOfClassTwo.classTwoMethodOne.

If you want to access them from instances of the ClassOne/Two, don't
make them Shared.

Oh, and next time, telling us why it's not working will help, even just
an error message.
In this case it would have been something like "Can not access static
method via non static instance" which mostly gives away what the actual
problem is :)
--
Deanna Earley (***@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the
group.)
Loading...