|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to declare a sub classI have made a class like class MyClass public declare _AVariable as string ......... Public MySubClass as new SubClass end class class MySubClass ..............'some declaration end class how can I access the class with all its subclasses so that the subclass cant be assignd to a variable in a mod dim sc as mysubclass may not be possible Jan JR wrote:
Show quoteHide quote > Hi, I'm not sure I understand what you are asking? Can you be a little> > I have made a class like > class MyClass > public declare _AVariable as string > ......... > Public MySubClass as new SubClass > end class > > class MySubClass > ..............'some declaration > end class > > how can I access the class with all its subclasses > so that the subclass cant be assignd to a variable > in a mod > dim sc as mysubclass may not be possible > > Jan more specific? -- Tom Shelton JR wrote:
> I have made a class like Depends how the classes are used. If you're building an assembly and > class MyClass > Public MySubClass as new SubClass > end class > > class MySubClass > end class > > how can I access the class with all its subclasses > so that the subclass cant be assignd to a variable > in a mod > dim sc as mysubclass may not be possible referencing it from another project, then change the subclass to be defined with the Friend (assembly) scope. Your code can use it, but nothing "outside" your assembly can. Public Class MyClass End Class Friend Class MySubClass End Class If it's all within the /same/ project, you'll have to resort to nesting the classes and making the inner, subclass private, as in Public Class MyClass Private Class MySubClass End Class End Class HTH, Phill W. I would like to add
That if you want to access the inner class ,from the outside , you should do so by a property regards Michel Posseth [MCP] Show quoteHide quote "Phill W." wrote: > JR wrote: > > > I have made a class like > > class MyClass > > Public MySubClass as new SubClass > > end class > > > > class MySubClass > > end class > > > > how can I access the class with all its subclasses > > so that the subclass cant be assignd to a variable > > in a mod > > dim sc as mysubclass may not be possible > > Depends how the classes are used. If you're building an assembly and > referencing it from another project, then change the subclass to be > defined with the Friend (assembly) scope. > Your code can use it, but nothing "outside" your assembly can. > > Public Class MyClass > End Class > > Friend Class MySubClass > End Class > > If it's all within the /same/ project, you'll have to resort to nesting > the classes and making the inner, subclass private, as in > > Public Class MyClass > Private Class MySubClass > End Class > End Class > > HTH, > Phill W. > M. Posseth wrote:
Show quoteHide quote > "Phill W." wrote: Michel,>>> how can I access the class with all its subclasses >>> so that the subclass cant be assignd to a variable >>> in a mod >>> dim sc as mysubclass may not be possible >> Depends how the classes are used. If you're building an assembly and >> referencing it from another project, then change the subclass to be >> defined with the Friend (assembly) scope. >> Your code can use it, but nothing "outside" your assembly can. >> >> Public Class MyClass >> End Class >> >> Friend Class MySubClass >> End Class >> >> If it's all within the /same/ project, you'll have to resort to nesting >> the classes and making the inner, subclass private, as in >> >> Public Class MyClass >> Private Class MySubClass >> End Class >> End Class > I would like to add that if you want to access the inner class > from the outside, you should do so by a property. But to do so would also require the /Type/ of that Property to be exposed, which would make it possible to define a variable /of/ that Type, which the O.P. wished to avoid. More generally, though, I agree; the "outer" class should provide a means of getting hold of an instance/collection of any member class[es]. Regards, Phill W. Well i see we speak the same language :-)
regards Michel Show quoteHide quote "Phill W." wrote: > M. Posseth wrote: > > "Phill W." wrote: > > >>> how can I access the class with all its subclasses > >>> so that the subclass cant be assignd to a variable > >>> in a mod > >>> dim sc as mysubclass may not be possible > > >> Depends how the classes are used. If you're building an assembly and > >> referencing it from another project, then change the subclass to be > >> defined with the Friend (assembly) scope. > >> Your code can use it, but nothing "outside" your assembly can. > >> > >> Public Class MyClass > >> End Class > >> > >> Friend Class MySubClass > >> End Class > >> > >> If it's all within the /same/ project, you'll have to resort to nesting > >> the classes and making the inner, subclass private, as in > >> > >> Public Class MyClass > >> Private Class MySubClass > >> End Class > >> End Class > > > I would like to add that if you want to access the inner class > > from the outside, you should do so by a property. > > Michel, > > But to do so would also require the /Type/ of that Property to be > exposed, which would make it possible to define a variable /of/ that > Type, which the O.P. wished to avoid. > > More generally, though, I agree; the "outer" class should provide a > means of getting hold of an instance/collection of any member class[es]. > > Regards, > Phill W. > thanks
some of this helpt me but becaurse all the items in the class and subclasses are not menth to be changed I only use strings and read them from an xml file. Its only for translation of some texts in the program (multi languages) Jan Show quoteHide quote "M. Posseth" <MPoss***@discussions.microsoft.com> schreef in bericht news:93C7827E-352E-4CD9-9724-DF5B94DA54A3@microsoft.com... > Well i see we speak the same language :-) > > > regards > > Michel > > > > > "Phill W." wrote: > >> M. Posseth wrote: >> > "Phill W." wrote: >> >> >>> how can I access the class with all its subclasses >> >>> so that the subclass cant be assignd to a variable >> >>> in a mod >> >>> dim sc as mysubclass may not be possible >> >> >> Depends how the classes are used. If you're building an assembly and >> >> referencing it from another project, then change the subclass to be >> >> defined with the Friend (assembly) scope. >> >> Your code can use it, but nothing "outside" your assembly can. >> >> >> >> Public Class MyClass >> >> End Class >> >> >> >> Friend Class MySubClass >> >> End Class >> >> >> >> If it's all within the /same/ project, you'll have to resort to >> >> nesting >> >> the classes and making the inner, subclass private, as in >> >> >> >> Public Class MyClass >> >> Private Class MySubClass >> >> End Class >> >> End Class >> >> > I would like to add that if you want to access the inner class >> > from the outside, you should do so by a property. >> >> Michel, >> >> But to do so would also require the /Type/ of that Property to be >> exposed, which would make it possible to define a variable /of/ that >> Type, which the O.P. wished to avoid. >> >> More generally, though, I agree; the "outer" class should provide a >> means of getting hold of an instance/collection of any member class[es]. >> >> Regards, >> Phill W. >>
While not starting a debate BUT
textbox help VB2005 Passing multiple arguments to the client-side JavaScript function in AJAX thread dead lock Replace " character in string PRINTER INFORMATION Save Changes in VB.NET 2005 with Access 2003 --- Not using any Binding Navigator Hide property of component Catch Key Down Event anywhere on Windows Form ConfigurationManager unrecognized |
|||||||||||||||||||||||